Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how could I rewind my work on top of FETCH_HEAD

Tags:

git

After I pulled from the remote repository, I got the following messages:

  • branch develop -> FETCH_HEAD First, rewinding head to replay your work on top of it... Fast-forwarded my_topic to f05183b231e55864ae8d99db9456167af3413b6a

So how could I rewind my work on top of FETCH_HEAD?

like image 885
Pan Ruochen Avatar asked Dec 28 '22 01:12

Pan Ruochen


2 Answers

The message is a confirmation of what git has successfully done - it isn't asking you to do anything.

if you want to check that a branch contains a particular commit:

git branch --contains <hash>

It's not related to the question as asked but if you want to put commits ontop of others - that's where git rebase comes in - to re-order commits.

e.g.

git checkout master
...
git commit -vam "one"
...
git commit -vam "two"
...
git checkout somebranch
...
git commit -vam "three"
...
git commit -vam "four"

Commits one+two and three+four are in 2 separate branches. to get them in order:

git rebase master

Alternatively, you can apply a single commit simply by doing:

git cherry-pick <hash>

You can use git reflog to find the hash for any commit that you think is missing.

like image 181
AD7six Avatar answered Jan 09 '23 19:01

AD7six


Did you add and commit everything on your own side first? To check that, do a

git status

If you didn't, you should always do that first and then try pulling again.

like image 42
bill-x Avatar answered Jan 09 '23 18:01

bill-x