We use this more othen then not here, and never have problems. It's a great way to work on a dedicated feature while still getting features from others, yet doesn't suffer from sometimes hard to read history. Does this mean rebase is king and merge isn't? No. Is it the other way around then? Also no. Both are fine if you know how to use them.
True, but the big benefit of git comes from those branches being public, IMO.
> and even then some communication with the other people makes it pullable: tell them to first git reset --hard xxxxx
If other people are actually using the changes on your branch (and if not, why did they pull it?), you end up having to do staircase rebases, with everyone fixing the same conflicts again every time they rebase. It's not the end of the world, but it's noticeably worse than using merge.
> yet doesn't suffer from sometimes hard to read history
IME the only difficulty comes with tools that try and display a linear view of history, and with rebase you sacrifice an accurate time-ordering of commits, making it very hard to find a commit if you were working on several branches at the same time. As long as you configure your tool to show a tree/graph of commits, merged history is easy to follow, and keeps the time-order correct.
I don't know if you've looked at the graph of a Git repo where people merge instead of rebase, but even in that view it's nearly impossible to track even the history of master. It's a mess. Rebase builds such cleaner graphs that I would only advocate merge when you have no reason to ever look at the graph view.
For me, almost all of the time, when I'm ready to merge to master I can almost always squash all my work into one or two clean commits. At that point a fastforward is the simplest solution. Merge-only workflows are great for long-lived public branches (if you have an integration and release branch for instance) but they're insane for feature branches.
We use merge instead of rebase. Here's a snapshot of the graph:
| | | | | | | | | | | | | | |
* | | | | | | | | | | | | | |
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ \
| |_|/ / / / / / / / / / / / /
|/| | | | | | | | | | | | | |
| | | | | | | | | | | | | | |
There are only 4 people working on the repo.as a real world example bitbucket added a cool feature recently where they grey out merge commits.
personally i love rich and complete history, including merge commits - any practice that damages that is something i'll be highly reticent about adopting.
irl i generally don't need to time travel to achieve my goals...
Interesting. I went a different route by making it very easy for users to dissect a merge commit. For example, if you click on the "Find included commits" link in the first commit at:
http://ny.testdrive.gitsense.com/index?#pid=13&cid=20&trail=
you'll be able to see all the commits that it included.
The only reason I can think of for others to pull your personal topic branches are to review it locally or help you debug something. Others shouldn't be branching off of your personal topic branches to work on them, use feature flags instead.
We do continuous delivery and our branches typically live for about an hour before they are pushed to production.
Continuous delivery is about working in small deployable steps and using techniques that allow you to release incomplete features into a production environment (Feature toggles, Branch by Abstraction).
Feature branches are pretty much the opposite of continuous integration. By definition your changes are not integrated into production or with other people using other branches
In fact, the TeamCity CI system now supports automatically building feature branches -- so the two concepts are definitely not at odds.