SetUp Merge Conflict Error

I accepted the incoming changes everywhere. I want to resort it to the last commit for which i had submitted my assessment for Module 1. I don’t have a single clue how to go about it. Please please please help. I don’t know what I have done. But now have 4 files of PortfolioManagerApplication.java with various changes in all of them. I don’t want to lose all my work. There is BASE, REMOTE and what not. Can you please revert it back to the state after it passes the assessment of module 1. @Saurav_Crio.Do @Rahul-Crio.do

There are plenty of ways to go back. Check this link.

try
git reset --hard HEAD

You can never lose any work. Follow these steps:

  1. If you want to see your previous work go to the previous module assessment section.
  2. Click on git commit details that show a long string of numbers.
  3. Now if you are not already logged in it will ask you to log in to GitLab crio.do
  4. Click on the commit button that appears in the left side in the list here you can see all of your work
  5. Now you can copy the old functions from here.
  6. Or if you want to revert back then use commit number of specific commit with the command of revert back any commit. git checkout

I used git reset --hard HEAD
Head was at the last assessment commit when i did the assessment. I did git log to see this. Then I manually deleted the additional weird files like BASE, REMOTE, LOCAL of PortfolioApplication and what not.
Then I executed the commands of module 2 setup commands. Retained both changes and then deleted the parts which weren’t necessary.
Will this do?
Also there won’t be any changes in PortfolioApplicationManagerTest right? Because it shows the same test for the extracted symbols like APPL, and the test for the date with APPL and everything
Is all this right ?
did i mess it up again?
Please confirm or give feedbacks
@S4G4R @tushar @vipulkrishna @Saurav_Crio.Do @Rahul-Crio.do


This is the result of my git log
How do I revert back to commit no. 4ed6ea4…
I used git reset --hard HEAD. Then I manually deleted the additional weird files like BASE, REMOTE, LOCAL of PortfolioApplication.
I executed the commands of module 2 setup commands. Retained both changes and then deleted the parts which weren’t necessary.
When I execute git commit :

crio-user@chiplonker-d:~/workspace/chiplonker-d-ME_QMONEY$ git commit
U qmoney/src/main/java/com/crio/warmup/stock/PortfolioManagerApplication.java
error: Committing is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm ’
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

This is the output even though I have resolved the conflict.
After resolving all conflicts, I have retained the todos and deleted the previous imports and retained the new ones, included the call to the new Quotes function in main
After doing this, I tried to commit I am getting the above error.

Can you please just revert my workspace to the commit I did when my assessment passed i.e. commit no - 4ed6ea4…
This error is taking a lot of time and I want to make it to my deadline @Saurav_Crio.Do @Rahul-Crio.do

Or now that I that I have resolved conflicts, do i Just continue working? and then just commit everything while submitting the assessment

If you have solved the merge conflicts, then go ahead with the module tasks, no need to commit now.

Seems like you used the git mergetool

Git merge tool is a utility to resolve merge conflicts efficiently. You can otherwise resolve them manually. When you run the merge tool git will create multiple instances of the file. Each containing different code. You just need to delete the irrelevant files.

To learn more about merge tool you can refer to this doc -
https://git-scm.com/docs/git-mergetool

It’ll be really good if you could watch a few video tutorials on Youtube regarding git.


Can It be helpful?

  • If you want to test the previous commit just do git checkout <test commit hash> ; then you can test that last working version of your project.
  • If you want to revert the last commit just do git revert <unwanted commit hash> ; then you can push this new commit, which undid your previous commit.
  • To fix the detached head do git checkout <current branch> .

So right now, I did git reset --hard HEAD.
My head moved to the last committed state which was when i passed the assessment.
Then I executed commands of the setup in Module 2, it showed that the repo was already created but then showed the conflicts.
I resolved the conflicts and tried to commit which gave the above mentioned output
And also deleted all the unwanted files like BASE and everything
I can just continue right? @Sakshat-Crio.Do @tushar

1 Like

Yes you can continue with the module instructions.

Thank You so much Sir