I’m developing a feature in a local branch. I just rebased it, and merged my changes back into the main branch. If I want to continue to develop in a local branch, can I continue to develop in the existing one? If I rebase with that branch, will it rebase the commits since the last merge, or will it once again rebase all the commits that have been made to that branch?
Or should I just delete it and start a new one?
Thanks.
Yes, you can carry on working on your local branch (let’s say it’s called
feature) and whenever you like do agit rebase masterwhile onfeature. The one point of caution about this is that in general you shouldn’t rebase your branch once you’ve made it public (i.e. pushed it to another repository or allowed someone to fetch it from your repository). You should only merge yourfeaturebranch intomasterwhen you consider the feature that you’ve been developing to be complete and tested. After that, if you want to add another feature, I would create a new branch for that.When you run
git rebase masterwhile you’re onfeature, git starts by considering every change infeaturethat isn’t inmaster. (This is approximately the set of commits you see fromgit log master..feature.) It then tries to reapply the changes introduced by each of those commits ontomaster, but skipping any that seem to have already been applied. The implication of this in your situation is that if you’ve mergedfeatureintomasterand then made some more commits onfeature, it’s only those since the merge that will be reapplied in a subsequent rebase.