In the example that the Git docs give for git rebase --onto
its not clear about what the ~ means
A range of commits could also be removed with rebase. If we have the following situation:
enter code here E---F---G---H---I---J topicA
then the command
git rebase --onto topicA~5 topicA~3 topicA
would result in the removal of commits F and G:
E---H'---I'---J' topicA
This is useful if F and G were flawed in some way, or should not be part of topicA. Note that the argument to --onto and the parameter can be any valid commit-ish.
Does topicA~5
mean 5 commits from the head of topicA
? (So counting backwards?)
I cant think of anything else that it would mean but I want to be sure before i try it on my repo.
This is from git rev-parse
<rev>~<n>, e.g. master~3
A suffix
~<n>
to a revision parameter means the commit object that is the<n>
th generation ancestor of the named commit object, following only the first parents.
I.e.<rev>~3
is equivalent to<rev>^^^
which is equivalent to<rev>^1^1^1
.
So in your case, yes, topicA~5
mean 5 commits from the head of topicA
: commit E
.