lewen7er9
lewen7er9

Reputation: 63

git revert and git checkout

Are the following combinations of commands equivalent?

Combo #1:

git revert HEAD
git revert HEAD

Combo #2:

git revert HEAD
git checkout HEAD^
git commit

Related thread: Git cancel a revert

Upvotes: 1

Views: 795

Answers (1)

Adam Dymitruk
Adam Dymitruk

Reputation: 129526

Yes, except you will be prompted for the commit message in the commit in combo 2. Unless you memorized the format of revert messages and look at the commit you are reverting, you will have a different sha-1.

You can force custom messages in a revert with a --no-commit option and then you can paste in the same message in both case.

Hope this helps.

Upvotes: 1

Related Questions