

In both cases on the master branch, we had two commits F and G that are not reachable from the next-feature branch. We can do:Ī-B-C-F-G (master) A-B-C-F-G (master)ĭ-E (HEAD next-feature) D'-E' (HEAD next-feature) When we use git rebase and we are already on the branch which we want to rebase, we can skip a second argument. Their unique identifier generated by cryptographic hash function SHA-1 ( dce79fd), which we often call just SHA, changed. On this branch, we still get access to our code in commits D and E, but they are not the same commits. Git rebase is a command which allows us to have access to the latest commit that is reachable from and move our commits on top of it.Ī-B-C-F-G (HEAD master) A-B-C-F-G (master)ĭ-E (next-feature) D'-E' (HEAD next-feature)Īs you see above after git rebase our HEAD is always the last argument. Right now, we will cover it very quickly. So if you want to know more about git rebase go there. I wrote a separate article about git rebase. First, we will focus on just a simple git rebase. But before we go there, we need to understand the differences between git rebase -onto with two and three arguments.

You can change the parent branch and remove some commits at the same time. Of course, you can combine these two reasons.

ONTO THE NEXT ONE MEANING HOW TO
In article How to change parent branch in git? I talked quickly about using git rebase -onto in a case when you want to replace the current parent branch.
