0

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.

2
  • recommended reading: Where does my git question go?
    – gnat
    Oct 27, 2014 at 10:23
  • Branches can track an upstream for rebase. I don’t know if that existed in 2014, or if that is what you are asking about. Apr 28 at 20:35

3 Answers 3

1

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.

0

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).

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.