Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Clanpot Shake
Aug 10, 2006
shake shake!

I can't speak to CVS, but having gone from svn to git, the way branching works alone is benefit enough to switch. I didn't find it hard at all to grok.

Adbot
ADBOT LOVES YOU

Volguus
Mar 3, 2009

Clanpot Shake posted:

I can't speak to CVS, but having gone from svn to git, the way branching works alone is benefit enough to switch. I didn't find it hard at all to grok.

What exactly (from a user's perspective) did you hate about svn branching vs git? I used svn until 2003 or so, then moved to perforce (since the company i moved to used perforce) and only using git since 2008. I honestly forgot what was so bad about svn branching (i do remember not having that many branches before though).

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
SVN could get confused, and require you to go in and manually fix things up. I haven't had to touch svn in about 4 years though, so I don't know if that's still true.

Rubellavator
Aug 16, 2007

When you're merging code into trunk or another branch that includes commits already made to that branch, svn sometimes can't handle that. I know I've had to literally do a merge that included only commit 1-4 and 6-8 of a branch. Because commit 5 is a merge of trunk which I already had in my branch, and svn wants to replay those changes again which causes a tree conflict.

Sometimes it was easier to make a patch file and apply it to the other branch rather than do a merge.

revmoo
May 25, 2006

#basta

Rubellavator posted:

When you're merging code into trunk or another branch that includes commits already made to that branch, svn sometimes can't handle that. I know I've had to literally do a merge that included only commit 1-4 and 6-8 of a branch. Because commit 5 is a merge of trunk which I already had in my branch, and svn wants to replay those changes again which causes a tree conflict.

Sometimes it was easier to make a patch file and apply it to the other branch rather than do a merge.

Svn is so terrible.

lifg
Dec 4, 2000
<this tag left blank>
Muldoon
Why is SVN so bad at merging?

Gift holds everything as snapshots, and it does so well. I don't get why SVN never worked as well.

revmoo
May 25, 2006

#basta

lifg posted:

Why is SVN so bad at merging?

Nobody really put much thought into this stuff till LT sat down and was like "this is crap" and wrote Git. Svn was great.... for its time. Now it's practically anachronistic.

Volguus
Mar 3, 2009
Svn required a certain process to be followed and bit you in the rear end if you didn't. The anecdotes above confirm that.
From personal experience, Git requires a process to be followed as well, if you want to be happy and not have headaches. Sure, it handles certain things better than Svn but is not without its faults. You can confuse Git without too much trouble too.
The idea is that if your organization is following the svn process and the tool itself doesn't get in the way of developers, nightly build, etc. there really shouldn't be any reason to move to git. The worst thing is to change for the sake of change.

lifg
Dec 4, 2000
<this tag left blank>
Muldoon

Volguus posted:

Svn required a certain process to be followed and bit you in the rear end if you didn't. The anecdotes above confirm that.
From personal experience, Git requires a process to be followed as well, if you want to be happy and not have headaches. Sure, it handles certain things better than Svn but is not without its faults. You can confuse Git without too much trouble too.
The idea is that if your organization is following the svn process and the tool itself doesn't get in the way of developers, nightly build, etc. there really shouldn't be any reason to move to git. The worst thing is to change for the sake of change.

Oh I love Git, but it's definitely more of a toolset that you build a version control solution with. A toolset than includes hammers, screwdrivers, and couple chainsaws. It requires a well defined process and good training more than any other version control I've used.

revmoo
May 25, 2006

#basta

lifg posted:

Oh I love Git, but it's definitely more of a toolset that you build a version control solution with. A toolset than includes hammers, screwdrivers, and couple chainsaws. It requires a well defined process and good training more than any other version control I've used.

Only if you have devs with aspergers on your team. Otherwise it's dead simple.

HFX
Nov 29, 2004

lifg posted:

Oh I love Git, but it's definitely more of a toolset that you build a version control solution with. A toolset than includes hammers, screwdrivers, and couple chainsaws. It requires a well defined process and good training more than any other version control I've used.

I find git much easy to deal with in everyday development. It is also usually easier for me to fix when a developer on my team does a force commit wiping out everyone's work for the last 4 months.

I also have to deal with svn at work. I've ran into so many headaches trying to merge things together over time. The worst case is when several developers create branches whole cloth without using the copy command. Bonus if they have merged these together several times. Trying to merge that back into trunk or a release branch ends up taking me a day or more withblota of praying I got it right.

comedyblissoption
Mar 15, 2006

the killer feature of git over svn by far is being able to easily merge branches. this allows you to create small self-contained branches for each feature you develop.

svn makes it easy to create branches, but it completely misses the point by making it a really loving terrible experience to merge. thus, most people using svn avoid branching and only really use it in a hamfisted way to section off older versions of the software.

the svn way of not using branches for features suck, because what ends up happening on most development teams is that you have to work with a bunch of in-progress half-finished bullshit other people are pushing to the central repository that might break your poo poo and then you have to keep tracking down these problems over and over again

comedyblissoption
Mar 15, 2006

this is a superior way to develop even if you're literally just a 1-man dev team

FlapYoJacks
Feb 12, 2009

HFX posted:

I find git much easy to deal with in everyday development. It is also usually easier for me to fix when a developer on my team does a force commit wiping out everyone's work for the last 4 months.

I also have to deal with svn at work. I've ran into so many headaches trying to merge things together over time. The worst case is when several developers create branches whole cloth without using the copy command. Bonus if they have merged these together several times. Trying to merge that back into trunk or a release branch ends up taking me a day or more withblota of praying I got it right.

Woah, you need to turn protected branches on! Don't EVER let ANYBODY force commit.

smackfu
Jun 7, 2004

Our problem is that we do a lot of force pushes to our feature branches to get a clean history before merging, which generally doesn't cause any problems. So people sometimes don't realize what a bad idea it is to force push to master. "Oh I'll just fix that typo in the commit message." We really should block it, but I vaguely recall the Stash plugin for that being all branches or none.

Space Kablooey
May 6, 2009


I also work with cleaning history before merging branches, and I did a git push -f origin master while on an unrelated branch a few days ago. Luckily my coworker had a local copy of the repo and he averted the crisis. I then learned about the git push --force-with-lease command which pushes to the current branch only if there has been no work done on it.

smackfu
Jun 7, 2004

Oh that reminds me... apparently there is a git option (push.default) that makes git push work on the current branch only vs working on all your branches. One of our devs didn't have that set correctly and someone else was pairing with them and did a force push to all branches. Oops.

Clanpot Shake
Aug 10, 2006
shake shake!

What's with all the forcing? I don't think I've ever needed to use that flag, and knowing what it does means you better be drat sure you know what you're forcing before doing it.

Stash has an option to squash history when merging PRs if you need a clean way to revert.

We have our setup pretty locked down. No pushing to master (with some select exceptions), PRs require 2 approvals and a green build, history squashed to make revert easy.

spacebard
Jan 1, 2007

Football~

Clanpot Shake posted:

What's with all the forcing? I don't think I've ever needed to use that flag, and knowing what it does means you better be drat sure you know what you're forcing before doing it.

Stash has an option to squash history when merging PRs if you need a clean way to revert.

We have our setup pretty locked down. No pushing to master (with some select exceptions), PRs require 2 approvals and a green build, history squashed to make revert easy.

I really like that they added the squash feature to PRs in recent versions. It makes git flow easier to swallow since merging from downstream doesn't necessarily pollute history making it easier to follow.

a foolish pianist
May 6, 2007

(bi)cyclic mutation

Yeah, the only times I've had to force anything, I'd hosed something up badly.

geeves
Sep 16, 2004

comedyblissoption posted:

the killer feature of git over svn by far is being able to easily merge branches. this allows you to create small self-contained branches for each feature you develop.


I think the killer feature of git was not having branches as different directories in your file system. So literally we would have app/trunk, app/branchA, app/branchB, etc.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

HardDiskD posted:

I also work with cleaning history before merging branches, and I did a git push -f origin master while on an unrelated branch a few days ago. Luckily my coworker had a local copy of the repo and he averted the crisis. I then learned about the git push --force-with-lease command which pushes to the current branch only if there has been no work done on it.

Why not just make another branch and clean that up locally before pushing it....

necrobobsledder
Mar 21, 2005
Lay down your soul to the gods rock 'n roll
Nap Ghost
If you're in a really low velocity, low quality shop ( < 3 commits / day across 5 engineers with no code review is what I've observed is the line between low before competence and velocity starts increasing towards a hockey stick pattern) with really easily separated, non-overlapping developers svn works fine honestly. Increasingly, code review tools are becoming stagnant in that market which also reflects the kind of companies that are still on svn - usually dinosaurs or where the SCM is completely unrelated to their problems.

Really tired of shops (as a consultant) where I'm the first developer to have issued a pull request in years because everyone has committed directly to master and nobody has ever run into merge conflicts despite these practices, so I can't even rationally argue for a lot of git use cases because they're not problems they ever have.

Progressive JPEG
Feb 19, 2003

Clanpot Shake posted:

PRs require 2 approvals

This ensures that the two reviewers each assume the other reviewer actually looked at the PR

Gildiss
Aug 24, 2010

Grimey Drawer

Progressive JPEG posted:

This ensures that the two reviewers each assume the other reviewer actually looked at the PR

Current place our lead devs got scolded for being too demanding on PRs for a group of expensive contractors and we were slowing them down. So now we approve everything without looking and can't wait for the regression and meltdowns to occur because their code is absolute garbage they don't even test locally before pushing up.

spacebard
Jan 1, 2007

Football~

geeves posted:

I think the killer feature of git was not having branches as different directories in your file system. So literally we would have app/trunk, app/branchA, app/branchB, etc.

It is not at all obvious, but apparently you're supposed to use svn switch. Then you only have trunk, branchA, or branchB checked out, and then svn switch when you want to change trees.

svn co https://path/to/repo/trunk appname
cd appname
svn switch https://path/to/repo/branches/branchA

Clanpot Shake
Aug 10, 2006
shake shake!

Progressive JPEG posted:

This ensures that the two reviewers each assume the other reviewer actually looked at the PR

Fortunately (?) the stakes are high enough in a dollar sense that code gets looked at. Unfortunately we have so many cooks in the kitchen weird poo poo slips through and breaks something anyway, but that usually comes down to author incompetence than the reviewers.

raminasi
Jan 25, 2005

a last drink with no ice

a foolish pianist posted:

Yeah, the only times I've had to force anything, I'd hosed something up badly.

They're necessary if you ever do any rebasing.

Phobeste posted:

Why not just make another branch and clean that up locally before pushing it....

And what, open a new PR? That's way more annoying and confusing than just blowing away a private branch history.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

raminasi posted:

And what, open a new PR? That's way more annoying and confusing than just blowing away a private branch history.

Why? With github you can make a comment in either PR invoking the name of the other and both of them will get links in the comment stream to the other one; just say "closed in favor of #152" or "supercedes #151" or whatever. Probably other git platforms have the same thing. Force pushing is terrible and branching and PRs are free.

Space Kablooey
May 6, 2009


Phobeste posted:

Why? With github you can make a comment in either PR invoking the name of the other and both of them will get links in the comment stream to the other one; just say "closed in favor of #152" or "supercedes #151" or whatever. Probably other git platforms have the same thing. Force pushing is terrible and branching and PRs are free.

But the goal is to not have a PR with a million individual commits, and only have the final changes in the PR. "I don't have to know how you got there", were my supervisor's words.

smackfu
Jun 7, 2004

If the code review interface just shows a squashed view, and it can do a squash merge, then it doesn't seem like it really matters.

Space Kablooey
May 6, 2009


Agreed on the first point, the tools we used had always shown the squashed view. As for automatic squash merging, it is still iffy on GitHub et. al. because they take the first commit message and apply that to the squashed commit. In my case, the first commit is almost always "add tests" or something useless like that, so I take the opportunity to change that message when merging.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

smackfu posted:

If the code review interface just shows a squashed view, and it can do a squash merge, then it doesn't seem like it really matters.
And in the case of tools like Gerrit, you don't need to do any forcing anyway. The push just updates the changeset with your specified Change-Id as long as you preserve it between commits.

Mniot
May 22, 2003
Not the one you know
I commit and push pretty often on a feature branch, so my commit log looks like

quote:

WIP
WIP
WIP
adding tests WIP
WIP
WIP
WIP
WIP
WIP
WIP
WIP
new feature: allow capital letters in usernames
...

I push the branch so that I can work elsewhere if I want and because sometimes I want a coworker to look at some bug I'm having.

Once I'm actually ready, I rebase into

quote:

unit tests for capital letters in usernames
new feature: allow capital letters in usernames
tidy up code in touched modules
...

and force-push. GitHub's PR interface makes it really easy to look at those three commits one at a time.

Everyone with write-access to the master branch ought to be very careful, but it's not scarier than having root creds to the AWS account or access to the production database, etc.

One time the Product team got an intern and she was supposed to give surveys to potential users about which new features the dev team should work on. Her second day, the head of data science runs over to her desk "turn off your computer right now! You're deleting all our regression data!"

It turns out his team stored there terabytes of regression data in the company Dropbox. So first off, if you installed the Dropbox client it would immediately fill your laptop hard drive with their poo poo. And second, if you tried to delete those files to reclaim space, Dropbox would sync by deleting those files from everyone's machine. After they got things sorted out, he told her "it's weird! That seems to happen every time someone new joins the company." As far as I know, they have not changed their system.

Volguus
Mar 3, 2009

Mniot posted:


Once I'm actually ready, I rebase into


and force-push.

What? Why? Force-push? In almost 10 years i had to force-push once, only because someone force-pushed and broke everything. Force-push for no reason can do a lot of things, none of which are desirable.

Mniot
May 22, 2003
Not the one you know

Volguus posted:

What? Why? Force-push? In almost 10 years i had to force-push once, only because someone force-pushed and broke everything. Force-push for no reason can do a lot of things, none of which are desirable.

Because the branch is present on the remote repository and I'm rewriting the history on that branch. That's what force-push does.

I don't know what your workflow is that you believe is the One True Git Workflow, so I'm not sure how to explain what seems pretty obvious to me. Do you only work off of emailed patches?

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
As written, it sounds an awful lot like you are force pushing to the remote Master, not your own branch.

a foolish pianist
May 6, 2007

(bi)cyclic mutation

Yeah, I push to the remote version of my own branch, then make a PR. The above sounds like a nightmare.

This thread is making me terrified about how devs understand git.

a foolish pianist fucked around with this message at 04:01 on Apr 17, 2017

Mniot
May 22, 2003
Not the one you know

Volmarias posted:

As written, it sounds an awful lot like you are force pushing to the remote Master, not your own branch.

I don't see how you got that, but no, individual devs pushing from a feature branch directly onto master would be a very weird thing to do. I'm saying that I have a feature branch (or at other companies a private fork but same diff) and I want to both store my work-in-progress remotely and have a clean PR.

Git's not magically more dangerous than anything else. I remember going from HFS to a Unix machine and being freaked out that if you accidently "rm" a file you can't just recover it back off the disk the next week. But the solution isn't to never delete a file; it's to keep incremental backups and pay attention.

Adbot
ADBOT LOVES YOU

Xerophyte
Mar 17, 2008

This space intentionally left blank
Everyone who has mentioned force pushing sound like they're doing perfectly normal things. Pushing a rebase of a personal feature branch, doing history cleanups of a branch prior to review, merging fixup! and squash! commits after a code review, etc. There's nothing inherently wrong about pushing a history edit to the remote, as long as you do it to a branch that has no other active downstream clients.

You don't have to do any of that of course, but it's not some kind of esoteric dangerous practice done only by those who don't know how git works. Force pushing is pretty common in many workflows that prefer rebase over merge, or encourage cleaning up WIP commits, since it leaves a lot less junk to clean up than creating new branches all the time. You're not going to magically blow up the repo just by typing --force.

Sidenote: the worst git SNAFU I've seen was a dev who was new to git and used git merge to "swap" branches locally, and then regular-pushed the resulting frankenmerge to origin. It's the one time I've de-protected and force-pushed a history edit to master, because pretending that never happened and making some people deal with the hard resets was probably the lesser evil.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply