How to git rebase a branch with the onto command?

I have noticed that the two blocks of following git commands have different behaviours and I don’t understand why. I have an A and a B branches that diverge with one commit I want to rebase B branch on the lastest A (and have the commit on the B branch) No problem if I do: But if I do: It doesn’t work at all, nothing happens. … Read more

How to cherry-pick multiple commits

Git 1.7.2 introduced the ability to cherry pick a range of commits. From the release notes: git cherry-pick learned to pick a range of commits (e.g. cherry-pick A..B and cherry-pick –stdin), so did git revert; these do not support the nicer sequencing control rebase [-i] has, though. To cherry-pick all the commits from commit A to commit B (where A is older than B), run: If you want to ignore A itself, … Read more

How to cherry-pick multiple commits

Git 1.7.2 introduced the ability to cherry pick a range of commits. From the release notes: git cherry-pick learned to pick a range of commits (e.g. cherry-pick A..B and cherry-pick –stdin), so did git revert; these do not support the nicer sequencing control rebase [-i] has, though. To cherry-pick all the commits from commit A to commit B (where A is older than B), run: If you want to ignore A itself, … Read more

Undoing a git rebase

The easiest way would be to find the head commit of the branch as it was immediately before the rebase started in the reflog… and to reset the current branch to it (with the usual caveats about being absolutely sure before reseting with the –hard option). Suppose the old commit was HEAD@{2} in the ref … Read more

Undoing a git rebase

The easiest way would be to find the head commit of the branch as it was immediately before the rebase started in the reflog… and to reset the current branch to it (with the usual caveats about being absolutely sure before reseting with the –hard option). Suppose the old commit was HEAD@{2} in the ref … Read more