My branches are:
o---o support.2013.16 \ o---o---o---o---o master \ o---o---o hotfix/A
I need to copy hotfix/A to support.2013.16. I'm aware of cherry-picking, but is it possible to do something like
git rebase --onto support.2013.16 master hotfix/A
but without moving a branch but copying it instead?
The Rebase Option But, instead of using a merge commit, rebasing re-writes the project history by creating brand new commits for each commit in the original branch. The major benefit of rebasing is that you get a much cleaner project history. First, it eliminates the unnecessary merge commits required by git merge .
Reading the official Git manual it states that rebase “reapplies commits on top of another base branch” , whereas merge “joins two or more development histories together” . In other words, the key difference between merge and rebase is that while merge preserves history as it happened, rebase rewrites it .
Rebase is an action in Git that allows you to rewrite commits from one Git branch to another branch. Essentially, Git rebase is deleting commits from one branch and adding them to another.
Git rebase
really does copy the original branch to a new one; but because it moves the branch head, it feels like a move rather than a copy. If you used git branch
to add an additional branch head to the original branch, you would still have easy access to the original branch after git rebase
had made the rebased copy. So in your example
git branch rebased-A hotfix/A git rebase --onto support.2013.16 master rebased-A
leaves you with
o---o---o rebased-A (hotfix/A') / o---o support.2013.16 \ o---o---o---o---o master \ o---o---o hotfix/A
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