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
ChickenWing
Jul 22, 2010

:v:

What advantages are there in all this commit squashing nonsense? I would have assumed that more commits are generally better because you have more fine-grained information and control over your repo.

Adbot
ADBOT LOVES YOU

Space Kablooey
May 6, 2009


Less clutter in the graph visualization of already merged branches? :shrug:

CPColin
Sep 9, 2003

Big ol' smile.
My main motivation was that, when doing a git blame, it was becoming impossible to figure out what was going on when a single function had five different commits with useless messages and one commit that actually contained the issue number. In Eclipse, there'd be a rainbow of highlight colors on the line numbers, making it less clear that a function was added in a single task. It was often a problem when I was doing lots of bug triage, because I couldn't quickly figure out where code had come from and why.

darthbob88
Oct 13, 2011

YOSPOS

ChickenWing posted:

What advantages are there in all this commit squashing nonsense? I would have assumed that more commits are generally better because you have more fine-grained information and control over your repo.
On the other hand, more commits means that when I browse the codebase, I have to scroll through a foot and a half of "WIP MAYBE THIS WORKS LOL" intermediate commits in your branches, instead of just one or two squashed "Now we have a new feature, woo!" commit.

lifg
Dec 4, 2000
<this tag left blank>
Muldoon
I think it's a question of what you want to track. If you want to track granular changes to code, don't rebase. If you want to track features added, rebase.

This is why I say Git isn't a solution to a problem, it's toolbox that let's you build a solution. But you have to decide what you want your process to be, and build appropriately. Git requires a level of customization I never saw in (my admittedly limited experience with) SVN.

Hell I'm pretty sure Git was originally built with that in mind. The tools and documentation that it originally shipped with were so minimal you practically had to learn what a blob was before you could do anything.

Mniot
May 22, 2003
Not the one you know

ChickenWing posted:

What advantages are there in all this commit squashing nonsense? I would have assumed that more commits are generally better because you have more fine-grained information and control over your repo.

If you're shipping releases that run on-premises, you need to be able to move some bug-fixes between the support branch from a year ago and the in-development master branch. Having a clean commit log means that the person who has to move patches around doesn't want to kill themselves. You say "here's the commit you want: 'issue #2596 fix DB pool exhaustion'".

It's also nice if you've kept a Grand Moff-like grip on the commit history because you can look at the history for a file and make sense of it and even have confidence that you can roll back to prior commits without loving everything.

I do it so that my Github-based code reviews are more readable. Since I've already been in the habit of tidying my commits, I feel this is worth the small time investment it costs me.

It can be a lot of effort, though, and if nobody on your team ever even runs `git log` then there's no point in keeping it tidy. Probably the opposite, because you can inflate your Github score by keeping thousands of little commits: "oops" "write more code" "try adding comma" "remove comma" "add comma back on different line" "working!"...

Mniot
May 22, 2003
Not the one you know
Someone needs to dig up that HackerNews thread where they were debating whether or not the ideal git commit history would include every single keypress you made while working...

The Laplace Demon
Jul 23, 2009

"Oh dear! Oh dear! Heisenberg is a douche!"
You joke, but this could be interesting and useful filtered down to an undo-redo history in between commits.

revmoo
May 25, 2006

#basta
Rebasing is retarded. Force pushing is retarded. Git-flow is retarded.

You already have compressed history for added features, it's called a branch.

I've been using Git for the better part of a decade both in teams large and small, and all I've EVER seen the need (or benefit) for, is basic branching, committing, and merging. As a plus, you can onboard people by saying "here's our repo, make feature branches, merge them, go home at 5. Use PR's if you want.

If I added up all the time wasted by autistic engineers arguing about the proper Git process across all the companies I've worked at, it would far outweigh any sort of benefit that complex Git workflows might confer.

ToxicSlurpee
Nov 5, 2003

-=SEND HELP=-


Pillbug

darthbob88 posted:

On the other hand, more commits means that when I browse the codebase, I have to scroll through a foot and a half of "WIP MAYBE THIS WORKS LOL" intermediate commits in your branches, instead of just one or two squashed "Now we have a new feature, woo!" commit.

Git stash can really help lessen that. It became one of my favorite things because good lord did some of my "wip this is a save commit" things look painful after a while.

I had to fix some stuff that didn't work properly and it was just too drat hard to figure out which things were right or in the right order.

raminasi
Jan 25, 2005

a last drink with no ice

revmoo posted:

Rebasing is retarded. Force pushing is retarded. Git-flow is retarded.

You already have compressed history for added features, it's called a branch.

I've been using Git for the better part of a decade both in teams large and small, and all I've EVER seen the need (or benefit) for, is basic branching, committing, and merging. As a plus, you can onboard people by saying "here's our repo, make feature branches, merge them, go home at 5. Use PR's if you want.

If I added up all the time wasted by autistic engineers arguing about the proper Git process across all the companies I've worked at, it would far outweigh any sort of benefit that complex Git workflows might confer.

It's like watching the "making of" of a nightmare coworker/manager story :allears:

Space Kablooey
May 6, 2009


revmoo posted:

Rebasing is retarded. Force pushing is retarded. Git-flow is retarded.

You already have compressed history for added features, it's called a branch.

I've been using Git for the better part of a decade both in teams large and small, and all I've EVER seen the need (or benefit) for, is basic branching, committing, and merging. As a plus, you can onboard people by saying "here's our repo, make feature branches, merge them, go home at 5. Use PR's if you want.

If I added up all the time wasted by autistic engineers arguing about the proper Git process across all the companies I've worked at, it would far outweigh any sort of benefit that complex Git workflows might confer.

Sounds like hell to me.

revmoo
May 25, 2006

#basta

raminasi posted:

It's like watching the "making of" of a nightmare coworker/manager story :allears:

I would say you are projecting but no, this is the Dunning-Kruger effect at work. Take comfort in the fact that you're in good company.

Clanpot Shake
Aug 10, 2006
shake shake!

revmoo posted:

Use PR's if you want.

You must work with some really talented people.

Pollyanna
Mar 5, 2005

Milk's on them.


I suspect that choosing to do laundry over continuing the workday is quite a condemnation of a situation. :shepface:

Vulture Culture
Jul 14, 2003

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

revmoo posted:

Rebasing is retarded. Force pushing is retarded. Git-flow is retarded.

You already have compressed history for added features, it's called a branch.

I've been using Git for the better part of a decade both in teams large and small, and all I've EVER seen the need (or benefit) for, is basic branching, committing, and merging. As a plus, you can onboard people by saying "here's our repo, make feature branches, merge them, go home at 5. Use PR's if you want.

If I added up all the time wasted by autistic engineers arguing about the proper Git process across all the companies I've worked at, it would far outweigh any sort of benefit that complex Git workflows might confer.
This one here takes the cake for bad post

Clanpot Shake posted:

You must work with some really talented people.
Yeah, this is probably the worst part of an already awful Software Maddox hot take

revmoo
May 25, 2006

#basta
Yes the hot take where I said it makes more sense to use Git the way it was intended. How outrageous. Go spend time with your families you spergs.

(USER WAS PUT ON PROBATION FOR THIS POST)

CPColin
Sep 9, 2003

Big ol' smile.
Yeah, how dare we discuss working in development in this thread, of all threads!

Xerophyte
Mar 17, 2008

This space intentionally left blank
I mean, it's perfectly fine not to rebase things or use the history edit tools if you don't want to or think it helps; the mere existence of git commit --fixup isn't a gun to your head. Do what works for you and the people you work with.

Personally, for the stuff we do at work I think the time spent cleaning up history is worth it for making the log readable and debugging easier down the line. I don't expect that holds everywhere, but it's why we occasionally type git rebase --interactive --autosquash. Is it the One True Workflow as intended by Linus Himself? No clue, don't particularly care. Is it what you should do? Maybe, maybe not.

revmoo
May 25, 2006

#basta
Linus endorses rebase. The difference is 99% of devs and projects are better suited to a simple workflow.

Hughlander
May 11, 2005

revmoo posted:

Rebasing is retarded. Force pushing is retarded. Git-flow is retarded.

You already have compressed history for added features, it's called a branch.

I've been using Git for the better part of a decade both in teams large and small, and all I've EVER seen the need (or benefit) for, is basic branching, committing, and merging. As a plus, you can onboard people by saying "here's our repo, make feature branches, merge them, go home at 5. Use PR's if you want.

If I added up all the time wasted by autistic engineers arguing about the proper Git process across all the companies I've worked at, it would far outweigh any sort of benefit that complex Git workflows might confer.

One of my teams is replacing some middleware in the project from another division. So they've been working in that code base that follows what revmoo is suggesting. At some point during integration things broke in a very very odd fashion. So someone went to git-bisect the merge branch to see where things went wrong...

About 90% of the commits had messages of 'WIP' or '.'
Only about 80% of the commits don't compile.
Of the 20% that do, 50-60% don't link.
He was still bisecting it 3 days later when the problem was figured out.

At the retrospective at the end of the sprint we added to our DoD that we'd have a Clean Checkin Policy. Any commit that goes to master has to build. Even if it means force pushed previously shared branches and squashed commits.

revmoo
May 25, 2006

#basta
the problem is devs that commit bull poo poo like 'WIP' and think that's acceptable.

revmoo
May 25, 2006

#basta

Hughlander posted:

Any commit that goes to master has to build.

Also,

That is a very low bar. When it's up to me, nothing touches master until it's basically ready to deploy. Who the gently caress merges broken code to master?

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
It's git, the workflow is to commit early and often, because that's better than losing track of where you were or losing your code if your laptop catches fire. Ultimately, you can just go back later and fix it up to be a sensible commit to show to other human beings, unless your name is Rev. Moo, in which case all of your code is perfect the first time and your commits are always sparkling.

revmoo
May 25, 2006

#basta
Look, I'm right, and several of you are dead wrong. And who spends three loving days in git bisect? It is literally divide-and-conquer. after 24 work hours you should be able to literally bisect tens of thousands of commits.

Nippashish
Nov 2, 2005

Let me see you dance!

revmoo posted:

the problem is devs that commit bull poo poo like 'WIP' and think that's acceptable.

Not doing that is one solution. Another is the squash/force push thing you're arguing against.

Sometimes I think this argument is really about what the word "commit" should mean. There are "sensible units of history" and there are "snapshots of right now so I can get back here if I gently caress it up" and I'm pretty sure both of these things are obviously (1) not the same and (2) useful. Your workflow will make a particular choice of how to use features of your tools to turn one into the other and, shockingly, there is more than one way to do it.

darthbob88
Oct 13, 2011

YOSPOS
Related relevant article

quote:

Look, I don’t give two shits about my Git commits.

I have no shame — okay, maybe a little shame — dropping these commits into my repositories:
<commits reading "update this", "revert update this", "FUCKKK", "forgot this">

Over the last five years, I’ve gotten a lot of questions along the lines of “should I rebase my branches or deal with a merge commit or maybe even squash all of my commits down into a single commit before merging?” Like most pedantic programmer debates, my answer is usually “I don’t care, I’m going to grab another slice of pizza, you do you”, but I’ve been thinking about this a lot recently and I think there’s a more interesting question to consider instead:

Why do developers take different approaches to repository histories?

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

revmoo posted:

Yes the hot take where I said it makes more sense to use Git the way it was intended. How outrageous. Go spend time with your families you spergs.

Intended is a weird concept. Git was built for people to email patches, which are manually applied by testers and integrators. There's still some nice tools for creating, sending, and applying patches in every installation of Git.

FlapYoJacks
Feb 12, 2009
If you don't push at the end of the day, every day, you are doing it wrong
I don't give a gently caress if it's a work in progress, it's a easy way to see what you did for the day, and to save it.
Everything in master better be in deployable shape and tagged.

ChickenWing
Jul 22, 2010

:v:

Stop gettin' mad about video games commit history

KoRMaK
Jul 31, 2012



I used to think squashing and history management was real obsessive, but I think I'm coming around to it. Haven't done it yet but I got another dev on the team who makes a lot of "fix thing" "refix thing" "undo fix thing" - a bunch of experimentation commits basically.

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun
I do a bunch of that, I should totally squash my history, good idea.

I do that especially if I'm jumping around a lot and need to save my work and don't want to stash it--I'm gonna forget that I have it stashed, for example.

lifg
Dec 4, 2000
<this tag left blank>
Muldoon
Presented without context, from a paper from 1996.

quote:

Why would the internet community prefer to rediscover and reimplement all the technologies that the operating system community long ago solved?

Part of the answer is certainly that engineers like to reinvent the wheel, and that they are naturally lazy and build the simplest possible system to satisfy their immediate goals.

Hughlander
May 11, 2005

revmoo posted:

Also,

That is a very low bar. When it's up to me, nothing touches master until it's basically ready to deploy. Who the gently caress merges broken code to master?

Look, I'm right, and several of you are dead wrong. And who spends three loving days in git bisect? It is literally divide-and-conquer. after 24 work hours you should be able to literally bisect tens of thousands of commits.


I'm pretty sure you're just not thinking. Person makes 15 commits, the 15th works and is pushed to master (rebased or merged, I'm not sure what this remote teams workflow was.) 14 of those are poo poo. So broken code isn't merged to master. However you're bisecting 10,000 commits after merging master into your long lived branch. Commit 5000 is one of those 14 that didn't build. You can't mark it as good or bad. And have to try +/- 1. Which also doesn't work. Take ~15 minutes for the compile failure or ~22 for the link failure and you're eating up a lot of time.

I get it, in the web world you're just not used to the size of the projects and the horribleness of out of country teams that are your customer. That doesn't mean everyone has those limited experiences.

revmoo
May 25, 2006

#basta
Wait, what project are you working on with 37 minute builds?

Gildiss
Aug 24, 2010

Grimey Drawer

revmoo posted:

Wait, what project are you working on with 37 minute builds?

Desktop Dick Sucking Enterprise Edition

Hughlander
May 11, 2005

revmoo posted:

Wait, what project are you working on with 37 minute builds?

Build + Link is 22 minutes. And a large large enterprise project. Of which we only develop part of the middleware and that full build time was a source build with the middleware integrated by the internal end customer.

Also:

quote:

When it's up to me, nothing touches master until it's basically ready to deploy.

That sure sounds a lot like a process, maybe even git-flow like particularly if multiple people/teams are collaborating on a feature prior to it being 'basically ready to deploy'

CPColin
Sep 9, 2003

Big ol' smile.
Meanwhile, the designer for the Ceylon language sure does like pushing straight to master:

https://gitter.im/ceylon/dev?at=58f39e8908c00c092a876976

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I am personally more in agreement with revmoo's take on this business, but I'm working with a fairly small group right now. I especially hate people committing stuff with the equivalent of "WIP: Did stuff." Mostly I hate WIP becuase, well, of course it's a work-in-progress. Do you think you will be making the last commit to this project forever?

A problem I had recently is that a few of us agreed to start working on somebody else's branch to do integration of different components before sending it back to master. What became implicit here was that branch was a master among us. In practice, that meant I had to wade through a pile of "WIP" and broken tests before I could even stir in my contribution. My complaints about this really frustrated the owner of that branch because, well, it was their branch and it was a work-in-progress. However, that person signed the social contract too.

Well, I suppose they didn't really understand what they signed. I tried to explain that when other people started working on a branch together, then the code that reaches that branch should be runnable at least for the bits we all are caring about. It's not just me getting butthurt about fetching new code and discovering none of it works. I am obligated to pass along code that works to everybody else.

I feel like there's a kind of evolution for source control. I kind of want to use that brain-expanding meme for this, but I might shoot myself for having done it:
1. Source control is a necessary evil so that multiple team members can work on code at the same time.
2. Source control is useful for me because it lets me back up my poo poo off of my computer.
3. Source control is good for me because it lets me take a shot at something without fear that I'll pain myself into an irrevocable corner.
4. Source control is great for me because it helps me manage all the little changes and nibbles I make while I'm thinking through stuff.

Unfortunately, I deal with a lot of people that are still in number 1 and will probably stay there forever. My local team is at least in number 2, but I don't know how far they've gotten beyond that. So I have to read up on policy stuff online to figure out what the grown-ups are doing. I found the whole rebase flow to be confusing.

Personally, I'd rather use merges instead of rebasing because I really do want to see how all the sausage is being made. If somebody's making incremental, broken, WIP changes, rebasing that into the branch isn't going to magically fix it. Well, if they squash in the process, it will, but I rarely see that. I'd rather all that poo poo sit in a side branch so I can inspect and bisect the master first before I try to find a smoking gun in a topic branch--if I ever even feel compelled to do that. However, all our tools here are set up to block merges by default, so we're kind of stuck in a rebasing hell hole. It's funny to me because the other team members have the damdest time wrapping their head around rebasing and would rather merge too.

So does Linus like rebasing for combining branches now? When I first heard about the religious war, I tried to look up what the Word of God had to say, and came across this.

Disregarding possibly cargo culting on something Linus said, I generally hate having a fully-linear, rebased history where different branches of commits end up getting woven together because sometimes the different changes aren't even sequentially cogent. The way I see people getting around that with Gerrit is just squashing their entire branch into a single commit for review. I am also unsettled by that because those single commits can get huge.

IMO I think a lot of methodologies end up being molded by external tools like GitHub or Gerrit, and people end up just take the limitations from them back into git.

The strangest thing I've seen BTW is somebody merging by basically cherry-picking their stuff on to the target branch. However, the best I could muster in reaction to it was to point at it and kind of mutter, "Yeah uhhh I don't ever see that, but, uhhhh you do you, I guess?"

Adbot
ADBOT LOVES YOU

Pollyanna
Mar 5, 2005

Milk's on them.


People at my work place are making plans to jump ship. It's sinking pretty drat fast. Looks like it's time to crank up the :yotj:, maybe I'll find a place with front-end engineers that actually understand that not everything works on all browsers. It's terrifying to think that I'm the most competent engineer in the room.

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