Question

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.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top