I have Main
branch from which I created 10 to 15 branches for each feature ie Feature01
, Feature02
, and Feature03
... Feature015
.
I am working on Feature01
branch, I did some commit also, but not yet merged to Main
branch.
But others branches ie Feature02
to Feature15
are merged into Main
branch.
I need to work on Feature01
branch to add more code. but now I want to get all code from Main
branch to my Feature01
branch and then I want to work on Feature01
branch.
You can merge the Main
branch into the Feature01
branch:
git checkout Feature01
git merge Main
Or you could consider rebasing Feature01
on the Main
branch:
git checkout Feature01
git rebase Main # or maybe origin/Main
The rebasing option would be best suited if you are the only one working with the Feature01
branch, and this branch has not been shared publicly yet.
Since you merged Feature02 to Feature15 into Main already, now you need to merge the Main branch into Feature01 , to keep it up to date.
This way Feature01 will contain all the changes you made in the other branches, but Main won't have your unfinished work from the Feature01 branch.
Once you are done working on feature 1, you can merge Feature01 back to Main.
When you have a lot of people working on your repository, you regularly merge Main into your feature branch, this way it doesn't go out date.
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.