I am using git for quite some time and wanted to use rebase
command. Earlier I have used only the merge
command.
I have my changes done to my feature branch which I need to merge with my master branch. I can go ahead and merge my changes to my master branch by running the git merge
command from the master branch. But can I use the rebase command to get my branch changes into my master? From the documentation, I understood that rebase will be done from the feature branches to merge the changes from the master to my feature branch. Is my understanding correct or I need to use the git merge command for my scenario.
But can I use the rebase command to get my branch changes into my master?
Yes:
git checkout feature
git rebase master # replay feature commits on top of master
git checkout master
git merge feature # fast-forward
Make sure you are the only one working on that branch, as a rebase will change (rewrite) its history, and you will need a git push --force
to publish your work.
See more at:
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.