I have a feature
branch that I work on. Yesterday I did a commit and also merged my feature
branch into the remote master
branch.
Now I wish to continue working on my branch and add more functionality. However, since yesterday other people have added some additional code to the master
branch. How can I "update" my feature
branch so that It has all latest changes from master
?
I could obviously just pull the latest version of master
and simply create a new branch off of it, but I guess there is away to "update" my current feature
branch.
First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch. Note: git merge merges the specified branch into the currently active branch. So we need to be on the branch that we are merging into.
Yes, there has the way to update feature
branch based on the latest master
branch. You just need to execute the command on feature
branch:
# On feature branch
git pull origin master --rebase
Now the feature
branch contains the latest changes of master
branch.
git checkout master
git pull
git checkout hotfix
git merge --no-ff origin master
git checkout master
git merge --no-ff origin featurebranch
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