#type/zk/zettel
# [[Git rebase onto]]
`git rebase -i head~3 --onto develop` changes the parent of the current branch to `develop`. That means that the last 3 commits of the current branch will be applied on top of `develop` and that will consitute the new version of this branch.
Example:
```
git checkout branch_that_needs_different_parent
git rebase -i head~3 --onto develop
```
In this example, we discard all but the last 3 commits of `branch_that_needs_different_parent` and change the parent to `develop`.
---
Sowed on:: [[2022-12-14|2022-12-14]]
Sources::
Keywords:: [[Git Rebase]]
Continuation::
Branches:: [[Git rebase without onto]]
See also::