Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make a diff with amend commit

Tags:

git

git-amend

I wonder is that possible to show diff between two commits one of what is amend ? In other words does git save amended commits in history somewhere?

like image 581
Michael Z Avatar asked Nov 06 '15 09:11

Michael Z


1 Answers

An amended commit is no different than any other commit. In that sense it is perfectly possible to diff between a 'normal' commit and a commit that was amended.

In other words does git save amended commits in history somewhere?

There is not some list that holds all the commits that were amended, no. Amended commits are in the history just like all other commits.

When you amend a commit, it basically gets removed and replaced by a new one (it also gets a new commit hash) that has the changes from the original commit + the amended changes.

In the git reflog you can see your recent actions, and that does show the amending of commits. References from there can be used to for example undo a git commit --amend. Also see How to undo "git commit --amend" done instead of "git commit" for more details about that.

like image 84
Tim Avatar answered Oct 16 '22 13:10

Tim