Git: How to keep local feature branch updated with changes made in dev?
I’ve been following this guide for working with distributed git projects: http://nvie.com/posts/a-successful-git-branching-model/. It has worked well but now I have run into a snag. I have created a local feature branch. I would like to keep this feature branch up-to-date with the latest changes made in
dev. Is this possible? I was researching this and found I would probably need to use
rebase. But there were so many options I didn’t know exactly which one I needed to use. How would I do this?
2 Solutions collect form web for “Git: How to keep local feature branch updated with changes made in dev?”
λ git checkout dev λ git pull origin dev λ git checkout myfeaturebranch λ git merge dev
git rebase dev while on the feature branch should do the trick (update local dev from origin first, if necessary).
That will replay your changes from the feature branch onto dev, then sets the feature head to be the head of the new history.
rebase if your feature branch commits have not yet been pushed. It will rewrite your history. There are some caveats with
rebase which may or may not be worth the risk.