Let’s read the history of user’s commitment by $ git log firstly.

@{ }

We can find details information about these commits by order with syntax @{ }.

$ git show HEAD@{0}
$ git show HEAD@{1}
$ git show HEAD@{2}
$ git show HEAD@{3}

The syntax @{ } can also help us to check where a branch was some specific amount of time ago.
For instance, we want to find which commit node our project was yesterday, $ git show master@{yesterday}.
A few similar examples.

$ git show master@{2.days.ago}
$ git show master@{1.mouths.ago}
$ git show master@{1.years.ago}
$ git show master@{2.years.ago}

^ And ~

If we want to find father commit of bcb824, just write bcb824^ to represent it, if we want to check the change in commit Update2 README.md, we can use git show bcb824^^ to do it.

We often use git pull to fetch and merge data from another branch, it will generate a new commit for merging.
After that git can display the commit-graph with the following commands.

tree = log --graph --decorate --pretty=format:'%C(red)%h%C(yellow)%d%C(reset) %s %C(green)(%an<%ae>, %cd)%C(reset)' --abbrev-commit --date=local

git tree f7776f57692461bd32241c54bf5830d66c0ba117

The commit f7776f has two commit fathers, we can read the info of them by syntax ^1 and ^2.

git show f7776f^1
git show f7776f^2

HEAD~ is equal to HEAD^, but there will be an apparent difference if we add a number at the end of ~.
HEAD~2 means the grandfather of the current node rather than the second father.
Similarly, you can guess that HEAD~3 means the father of grandfather of the current node.

$ git show HEAD~3


The syntax .. is useful for us to compare different branches and commit nodes.
For instance, git log origin/master..HEAD help us to find all changes on the current branch but not pushed to the remote server.
Similarly, git log origin/dev..master gives us all commits exist on branch master but not on dev.
The following three commands are equivalent.

$ git log refA..refB
$ git log ^refA refB
$ git log refB not refA

Categories: Tool

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments

XOR Strings
: Input your strings, the tool can encrypt and decrypt them.

Would love your thoughts, please comment.x