Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git - rebase branch, built on top of another, on master

Tags:

git

github

I am working on a feature in a repo. I have created a feature branch (say branch_1) and another branch (say branch_2) on top of branch_1. I used to rebase branch_2 every time branch_1 was updated, but now the branch_1 is being merged into master so I want to rebase branch_2 into master, so that branch_2 have only its own changes. How do I do this? Also is the right way or is there any other method?

like image 705
Yathartha Joshi Avatar asked Mar 05 '23 19:03

Yathartha Joshi


1 Answers

You can just rebase this branch on master:

src/myproject (branch2)$ git rebase master

Any changes in contains that are already in master will be "swallowed" into those master changes, and you'll remain with just the distinct changes this branch contains.

like image 104
Mureinik Avatar answered Mar 16 '23 23:03

Mureinik