Reputation: 51
Step 1: I have master Branch followed by two commits, master branch $ git log master
34015a753b1
decde523115
Step 2: Then, i have one feature dedicated branch this branch created by based on master branch, $ git checkout -b feature master & git log
34015a753b1
decde523115
Step 3 : Then i made two commits on my feature branch,
$ git log
78035a743a6
42015a743a2
34015a753b1
decde523115
Step 4: Next my team mate made one new commits on master branch and then he pushed to remote server. $ git log master
24315a753b1
34015a753b1
decde523115
Step 5: suppose i want master new commit changes in my dedicated feature branch means, i have to run the command ,
git checkout feature
git rebase master
Right ! this is normal case to rebase the dedicated branch...
So now my question is: suppose i rebased wrongly on the public branch, master onto your feature branch,
$ git checkout master
$ git rebase feature
$ git log
Now my project history changed, my master branch remote commit id is different, and my local master branch id is different because of wrong rebase. Now how to undo this wrong rebase ?
Thanks.
Upvotes: 0
Views: 308
Reputation: 142084
Now how to undo this wrong rebase ?
Read this out and learn how to do it:
How to move HEAD back to a previous location? (Detached head)
You will find there a very detailed answer on several ways to "fix" it.
Upvotes: 1
Reputation: 74645
Use git reflog
to find the old commit and then git reset
the branch to it.
Upvotes: 1