Does Git have any command equivalent to Mercurial's "hg id"? I.e. a command that prints the parent commit's hash and a plus sign if there are changes in the working directory?
Description. The hg command provides a command line interface to the Mercurial system.
hg commit: save your changes in the current repository. hg log: see all changes in your repository. hg pull: get all changes from another repository into the current one. hg push: get all changes from your repository into another one.
Hg Init: a Mercurial tutorial. Mercurial is a modern, open source, distributed version control system, and a compelling upgrade from older systems like Subversion. In this user-friendly, six-part tutorial, Joel Spolsky teaches you the key concepts.
This command is equivalent to hg id --id
:
git describe --abbrev=12 --always --dirty=+
git log -1 HEAD^
will show you the whole commit including the SHA-1
If it's a merge, you can see the second parent's commit info with
git log -1 HEAD^2
If you have an octopus merge with more than 2 parents you can put any number in the tree-ish spec:
git log -1 HEAD^5
... to see the 5th parent's commit info
the -1
just limits the log output to one commit. You don't want the lineage of that commit reported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With