In hg I can use hg heads
to view all current heads. I still have not been able to find an equivalent in git. The git-hg rosetta stone doesn't give an answer.
As for hg parents
which in hg simply tells the direct ancestors of a node the rosetta stone simply reads the very unhelpful:
git log # you can read all the information you need from there (as long as you already know the answer to the question you're asking)
git rev-list HEAD
, git rev-list <sha1>
and git rev-list HEAD -1 -- file
are the equivalents of the different forms of hg parents
As for your detached HEAD problem, doing git checkout <sha1>
is meant for commit inspection and not for general workflow. If you want a branch off a commit, you have to do git branch <name> <sha1>
or git checkout -b <name> <sha1>
and work on it.
Due to the above reason, I feel that it is not ideal to talk of the equivalent to hg heads
in git as being all commits that don't have a child, but the closes equivalent is git branch
You can view all named heads with git branch
for branches and git tag
for tags. I'm sure there's a fancy way to display all heads (i.e. dangling commits) but keep in mind that these may be garbage collected by git under the default settings.
UPDATE
I just realized that this is really unrelated to the concept of heads in Mercurial. This will really show you any named revisions in the repository, which may or may not be useful for your purposes.
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