We recently switched to git from Team Foundation Version Control. I've found a tendency among our development team to want to make a local branch off of local master, call it local-dev, and then use that branch forever. We are using a pull request process so they push their local-dev onto the server and perform a pull-request onto master.
When the pull-request completes, they delete the server-dev branch but keep their local-dev branch. They just pull the latest into their local master, and then merge local master into local-dev. Then repeat the cycle.
Is this an OK thing to do? In my head I see that since their local-dev is never being rebased, they are continuously pushing all history since day 1 onto the server every time they do a pull request and are forcing the server to handle that merge. Which seems to work OK.
Is this a ticking time-bomb? Is this perfectly acceptable and I'm worried about nothing? What is the server doing to handle this merge?
Git uses revision walking to negotiate a common set of commits on both sides. So if, during a push, the client side knows what the server's master
branch is, then it will be able to eliminate anything it contains from being sent, including the old version of the local-dev
branch.
The workflow that's being used isn't necessarily inefficient for pushes, but repeated criss-cross merges between master
and the local-dev
branch make git log --topo-order
very slow. So while it may not be a problem for inexperienced Git users, it will make advanced users a little unhappy since it causes some slowness in advanced operations. It also creates an untidy history, which some people feel strongly about.
In addition, this workflow prevents having multiple branches in flight at once. A developer might need to wait to merge a branch because the subject matter expert is on vacation and can't give a review, and creating a new branch would allow working on a different piece of work while waiting for that review.
The typical workflow is to create a new, uniquely named branch for the feature or bug fix in question, make changes, and push that up. The local branch can be discarded when the server branch is merged (or kept if the person prefers).
So ultimately the answer is that this is not a typical workflow and it causes a few practical problems, but it isn't hugely problematic. It wouldn't be a problem to educate your users, but it's up to you whether you think it's important enough to enforce in policy.