I often have a workflow where I develop some feature in a Git branch, switch to another feature-branch, etc. During development, the original develop branch and the feature branches diverge.
Now when switching branches I am all of the sudden developing on an older version of my project (which is to be expected, of course).
I do wonder however whether something like a “tracking” behaviour can be configured with Git, which would mean that specially-marked feature branches would be automatically rebased on another branch (like develop
or master
). This would simplify a lot, especially rebuilds.
3
No, you just have to
git checkout feature-branch
git merge master|develop
Done, your branch is now up to date. It will also let you a chance to resolve conflicts early. Perform the merge periodically, and you’ll be fine.
No, there’s no automatic rebasing. The easiest way to achieve a very similar effect is to do single branch development, as recommended for continuous delivery (relevant article).
You can do
git checkout your_branch
git fetch # get the latest
git rebase master
Rebase will replay your changes on top of the latest master.
You will need to resolve any conflicts. Conflicts occur when the same line(s) in the same file are edited by both the latest master and the feature branch.
1