Reset workspace to beginning of QMoney module 2 [CLOSED]

I had completed my code for QMoney module 2, but while pushing my assessment was getting evaluated for module 1 instead. So, I tried to figure my way out through some git commands, but ended up with a messed up workspace. How do I reset my workspace to start of Module 2 and make sure the assessment get evaluated for module 2 and not for module 1…

If you wish to go back to the start of module 2 i.e delete everything you have done in module 2, follow the following steps:

In your terminal, type the following command:
git log

This will list all the commits you made with the commit id (sha256 hash sum)
Find out the commit corresponding to the one you did for submitting Module 1 for assessment.
Note down the sha256 hash sum of the commit. Be very careful while doing this. After you have noted down this commit hash sum, type the following command:

git reset - - hard ‘commit hash sum’

Eg: git reset - - hard 92beue28ebeb2

Once done, it will ask for your confirmation to do so. Enter y and press enter if you are sure about the commit hash sum. Then follow the instructions of the second module setup task and after resolving merge conflicts (if any), ensure that the metadata.json file in CRIO folder has the module name corresponding to the second module.

I did that and following it I tried to pull the code stubs for module 2, but it says remote already exists…
fatal: remote ME_QMONEY_MODULE_REST_API_STUB already exists.

If you have already done that, pull the stubs corresponding to module 2. If that throws an error, try reverting back to the end of module 1 code. You have to sit down trying to see which one is the commit for module 1 assessment.

Thanks a Lot . Looks like it worked. I am getting merge conflict and have the required files for module 2. I know how to proceed from here…

14 actionable tasks: 14 up-to-date
No stash entries found.
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push --help’ for details.

Got the above error while pushing…

Try a git force-push

crio-user@ravendras2:~/workspace/ravendras2-ME_QMONEY$ git push -f origin master

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.

14 actionable tasks: 14 up-to-date
No stash entries found.
Counting objects: 20, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (20/20), 2.85 KiB | 76.00 KiB/s, done.
Total 20 (delta 4), reused 0 (delta 0)
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ‘’

Got this

Okay to resolve this error, there is a way. If your code is correct, then perform a git pull origin master. Do note down the name of the current module in Metadata.json before doing that. If there are any merge conflicts, look closely and determine which changes to keep and which to discard. Now go to the Metadata.json and paste the module name you copied before pulling. This should work out.

N.B. Keep a copy of the code you did in this module just for backupm

After Git pull i lost my files in dto folder…

Removing qmoney/src/test/java/com/crio/warmup/stock/
Removing qmoney/src/main/java/com/crio/warmup/stock/dto/
Removing qmoney/src/main/java/com/crio/warmup/stock/dto/
Removing qmoney/src/main/java/com/crio/warmup/stock/dto/

Revert back to the previous commit.

I have reset repo back to previous commit. Now what to do?

Do you see those files reappear in the dto folder?

I got the following on git status:

On branch master
Your branch and ‘origin/master’ have diverged,
and have 1 and 4 different commits each, respectively.
(use “git pull” to merge the remote branch into yours)

nothing to commit, working tree clean

Okay so what I presume now is that your remote branch is updated to module 1 assessment. Then the way to do this and get out:
git pull origin master

This will delete all the things you did for module 2.

Use the setup task for module 2 and ensure the name of module is correct for module 2. Code it again and push.

I did the Same thing previously right, as you can see from previous posts in this issue…

The problem that arose is due to the fact that the name of the module was incorrect. If you pull the stubs for the second module and ensure that module name is correct and push again, it should be good to go. Otw what you could do is to copy all the files that get removed in the git pull process and create them back.

commit 564b5c7b58c57e4e8c37eb1a0488471012a3d8d1 (HEAD -> master)
Merge: 92b09d6 55171c3
Author: CrioUser
Date: Thu Mar 5 06:58:15 2020 +0000


commit 92b09d6ce1fa239d2a67d45843dfc4c1f83ae2c9
Author: CrioUser
Date: Sun Feb 23 17:38:38 2020 +0000


commit 55171c3aae4ec811fd8f67d8ff9431216626ab3b (ME_QMONEY_MODULE_REST_API_STUB/master)
Author: Crio.GitLab
Date: Wed Feb 19 16:36:40 2020 +0550

updated changes - 2020-02-19 16:16:40

commit bf702ea401d256ff4394e97ed907d2fdc0ba5cf2 (ME_QMONEY_MODULE_JSON_PARSING_STUB/master)
Author: Crio.GitLab
Date: Wed Feb 19 16:36:31 2020 +0550

updated changes - 2020-02-19 16:16:31

commit 74aff2bac28584f69a24fa0eda1e5da26327bef5
Author: Crio.GitLab
Date: Wed Feb 19 12:26:12 2020 +0550

updated changes - 2020-02-19 12:06:12

commit 58c7130163df95c575276f7bf46b6cab220d8dbd
Author: Crio.GitLab
Date: Wed Feb 19 12:26:01 2020 +0550

updated changes - 2020-02-19 12:06:01

commit 1b1c6ce94daa4da908a9548dcad5ce37beea23e5
Author: Crio.GitLab
Date: Tue Feb 18 17:40:04 2020 +0530

Update build.gradle

commit 307e960a2019343a9ccb982bcfc395a2645a960c
Author: sridherj
Date: Tue Feb 18 15:02:00 2020 +0530

Set Execute permission for gradlew manually

commit c50d26962f0f5fcec197b636a2021498a4818ed2
Author: Crio.GitLab
Date: Tue Feb 18 14:26:59 2020 +0530

Add new file

commit 3b9fa3cdc1975b4b5824affdc001399cea91a801
Author: Crio.GitLab
Date: Tue Feb 18 14:26:40 2020 +0530

Add new directory

commit 265163511ff53f70bc5c1f52cc1560b3feb539e7
Author: Kiran Suresh
Date: Tue Feb 18 14:05:45 2020 +0550

updated changes - 2020-02-18 13:45:45

commit 25d14e50f10d972de3dfb3d187fb81d3a17cdaf7
Author: Crio.GitLab
Date: Mon Feb 17 20:30:26 2020 +0550

first commit

commit 6d979e668b33860e0838dc7d0ebfbebf28d68064
Author: Crio.GitLab
Date: Mon Feb 17 20:30:10 2020 +0550

first commit

Above is my output of my git log.
Which sha do you recommend to reset my repo to?

Can you check in your gitlab whether the head of local and origin point to the same commit? Confirm this.

How do I check that ?
This is my local head
ref: refs/heads/master.
I don’t know how to check for orgin