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?
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.
I don't think there's a command exactly like that, but you can use:
git status --porcelain
which outputs a machine-readable listing of changed files in the repository. You can look for anything in the first column that is not ?
to indicate a changed file.
git status
would show the changes in the working directory, and the branch info.
I guess git log
can be used to see the last few commits.
git ls-remote REPOSITORY BRANCH
will show the hash of the head of a given branch.
© 2022 - 2024 — McMap. All rights reserved.
git rev-parse HEAD
can report the hash. – Livelihood