4 ms·
The major workflow shift that involves the skies parting and mana floating down from heaven when you switch to a DVCS (git, hg) is the ease and lightweight natu
by jdludlow 15y ago
The major workflow shift that involves the skies parting and mana floating down from heaven when you switch to a DVCS (git, hg) is the ease and lightweight nature of branching.
Having used git for four years, I now feel absolutely filthy if I'm not coding on a branch. If I start coding anything, I make a branch first, because the overhead is nearly zero, if I screw something up I can easily revert, and the downside of being scared to push code is too great.
Example: Yesterday I started a new feature. Step 1 was to branch from our develop branch. A bit into the coding I realized that this feature was going to take longer than expected. I committed what I had on my branch and pushed it to the remote repository (github in this case). This affects no one else, because the code is on a branch.
What really makes this possible is that merging is so easy. Branching and merging in svn was scary. I was never sure if something horrible was about to happen. With git (and hg) branching and merging is the expected behavior, and it's easy.
Always being on a branch also makes it easier to deal with interruptions. "Hey, there's an emergency, can you fix Foo?" No problem, commit what you have on your branch (or use `git stash` which is amazing) and jump back to the branch that has the code you need to fix. Need that fix in your branch as well? You can merge or simply `git cherry-pick` a single commit across branches. You no longer have to worry about the dreaded "Did I already merge this? What if I merge it again, what will happen?"
- Splines 15y agoThis. A thousand times this. I use perforce for my daily work, and all too often I'll get to a stopping point and think to myself that my approach isn't working - usually I'll wrap my stuff up in a changelist and save the diff off to a file. Then I need to revert to latest and start my work from there. It's not hard, but it's slightly painful, because if I wanted to try different approaches I end up having dpks lying around on my disk which have no easy relation to what they contain. I've been tempted to install Hg and use it's branching mechanisms on top of perforce, but I'm not so sure my workplace would condone that (plus, Hg + perforce may not play well - I'm not sure).
- excoder 15y agoUm ... you might want to try `p4 help shelve` first. Shelved changelists are basically the same as a "git stash" - but they're stored on the server, so other developers on your team can review a changelist before you actually submit it. One of my favorite Perforce features, actually.
- stottc 15y agoChangelists are a feature I really miss in other source control. It's nice to be able to keep orthogonal changes separate