Is the a shorter way of writing git diff HEAD^ HEAD?
You can use one of the following:
(Choose the one which suits you and make it an alias).
# the equivalent command (dry run) for pull/push
git log ^branch1 branch2
git log branch1 ^branch 2
git show
# to view the content of the last commit
git show
Shows one or more objects (blobs, trees, tags and commits).
For commits it shows the log message and textual diff. It also presents the merge commit in a special format as produced by git diff-tree --cc.
git log --cc
From git v>2.6 you have the --cc
flag added to the log so you can use
git log --cc
It will display the full log with the diff as well.
git diff-tree --cc HEAD
Very similar to the git log --cc
. Behind the scenes git show
is an alias to this command.
Try git show
. Without other options, it shows a diff of the latest commit.
git show $something
shows the content of $something
in a user-friendly way. When $something
refers to a file, git show
will display the file's content. When it refers to a commit, Git shows the commit (author, date, commit log and diff). git show
without more arguments is equivalent to git show HEAD
.
I also found in this post that @
is a shortcut for HEAD
. So
git diff @^ @
or
git show @
is also an option.