How can I revert my changes using 'git pull'?

I did 'git pull' instead of 'git pull --rebase'.

SHA: 138937298d80a7c84d0630b1db509ca2596aca91 // top of my git << some changes I got from 'git pull' >> SHA: SHA: << end of some changes I got from 'git pull' >> SHA: 08ebb55902e206a30d6f344b4684bd525970dda3 // my original top of my git before i do anything. 

My question is, how can I revert the changes I received from "git pull" and then I do "git pull --rebase"?

Another question: I use "gitx" on a Mac, the changes I received from "git pull" are on a different vertical line and the ones I had. Why is this? Thanks.

+4
source share
2 answers

Find the other HEAD you want to return using git reflog and then reset to commit. Usually, if you didnโ€™t do anything after attraction, it will be git reset --hard HEAD@ {1}

+3
source

Suppose you are on master and want to delete the remote changes in origin/master and reinstall your work on the โ€œofficialโ€ branch, but you made a mistake:

 git pull origin 

Now you have a fusion of your work and material from the server; this is not what you wanted!

 git stash save git reset --hard HEAD@ {1} git stash apply 

Now you are back to where you were before the traction, but you still want to make your changes on top of what was on the server ...

 git rebase origin/master 

There you go, everything is set up!

+1
source

Source: https://habr.com/ru/post/1343814/


All Articles