Rook Rook - 1 year ago 111
Git Question

Git relative revision numbers

Is it possible (somehow) to have in Git (local) relative revision (commit) numbers, like in Mercurial 0, 1, 2, 3, ... instead of short hashes?

Or anything more user friendly?

Answer Source

Just use:

  • master~10 to get the 10th last commit on branch master.
  • master^ to get the second last commit on branch master.
  • master^^ to get the third last commit on branch master.

They can even be combined: master^^~5^.

master can be any branch name (local or remote) or HEAD to reference the current commit.

You can use master^2 to get the second merge parent.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download