Reputation: 2045
current git log :
commit foo456
Merge: foo123 bar123
Author: foo
Merge branch 'master' of ......
commit foo123
Author: foo
change b
commit bar123
Author: bar
stable version
I am foo, if I want to revert to stable version (commit bar123), should I use git revert HEAD~1
or git revert HEAD~2
? That is to say, is Merge(commit foo456) also a valid commit ,
I am a little confused.
Upvotes: 1
Views: 431
Reputation: 993085
If you want to throw away the merge commit and go back to bar123
, use:
git reset --hard bar123
At that point, you can try the merge again.
The git revert
command creates a new commit that reverses the effect of a previous commit, but the presence of revert commits for future merges can be confusing and problematic.
Upvotes: 3