Git relative revision numbers

前端 未结 4 1656
余生分开走
余生分开走 2020-12-08 08:00

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

4条回答
  •  失恋的感觉
    2020-12-08 08:09

    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.

提交回复
热议问题