by tunesmith · 10y ago · 0 comments
I personally like to create a new branch locally - sometimes I'm experimenting and get ahead of my commits, and then I'll make 3-4 commits in bite-sized concepts. Other times I'll commit something that seems like it will probably work, and then I realize it doesn't, so I'm able to revert/reset the commit (so the commit is deleted rather than seeing a commit and then a revert in the log). And once I'm close to done, I can even rebase so my clean commits are all in a row. Then I push my branch.
I lose all that flexibility as soon as a team's process demands I push my branch as soon as I create it. I can no longer rebase (I still don't understand the guides that explain how to use rebase after pushing), reverts add noises to the log, merges from master interrupt the flow, etc. So in that sense, I can see the allure of a squash-and-merge to master.
I just don't think that pushing an empty feature branch takes advantage of the benefits of using git.
You have protection on your remote trunk branches against force push.
You have git configured to push only the branch you are on, to the same name on the remote.
git rebase; git push -f;
It is HARD, DANGEROUS and SHITTY under other configurations.
<3 Git.
It'd be nice if git let you push (for backup/protection) without letting other people see it or check it out yet.
Another option you might consider, if you need more flexibility, is doing your work in a branch off of your `feature-branch`, e.g., `feature-branch-wip`. When you're happy with your progress on `feature-branch-wip`, interactively rebase atop `feature-branch`, merge in, and push. Their process is satisfied, and they'll never be the wiser.