Strategy For Keeping Git Feature Branches Up to Da

2019-05-02 12:55发布

问题:

I like to keep my feature branches up to date with develop. Is there anything wrong with frequently doing "git merge --no-ff develop". And then at the end, running "git flow feature finish feature1". These feature branches are shared (which means it is possible that someone else could be working on it, or that I'm developing out of it at my computer at home), mostly because I like knowing that they are backed up somewhere else. If they weren't shared, would consistently rebasing be preferred?

Or is it better to not keep your feature branches up to date and just merge everything in at the end?

回答1:

If your branches aren't public, updating via rebase is the best method. If they are public, it's better to just merge them at the end (rather than consistently merging changes into them). Both strategies keep a simple, clean commit and merge history.



回答2:

Yes, I think consistently rebasing would be the preferred method. And git-flow currently has a command that serves this purpose (not sure if this command was around when the question was asked): git flow feature rebase <featurename>.



回答3:

This is how I adapted git-flow for a more powerful version:

https://plus.google.com/109096274754593704906/posts/R4qkeyRadLR

ymmv depending on how granular your work is.