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
Ice Fist
Jun 20, 2012

^^ Please send feedback to beefstache911@hotmail.com, this is not a joke that 'stache is the real deal. Serious assessments only. ^^

Jabor posted:

Therefore, anyone who knows the git CLI probably knows how to actually use git well

Sort of? I exclusively use the cli, but 98% of my work is using add/commit/push/pull/checkout/merge and if I encounter a situation even remotely outside of the happy path I get paranoid and start asking someone I trust to double check what I'm doing.

Adbot
ADBOT LOVES YOU

captkirk
Feb 5, 2010

Canine Blues Arooo posted:

It is completely absurd to me though that there is some weird expectation around 'knowing git' in this world. Yes, you should probably understand what the git words mean and how they map to functionality, but to be able to use the CLI is silly
I'm not saying folks should be able to do a git bisect without double checking the man pages but 'knowing git' well enough to handle basic operations (push, pull, commit, merge, status, diff, add, and log are probably enough commands) seems like a fundamental skill for a developer in a git shop.

Canine Blues Arooo posted:

CLI is a great feature set for certain use cases, but rarely for a human, and I don't take the suggestion to learn the git CLI very seriously. Of all the things I could actively learn, CLIs are such an enormous waste of time...and I don't really know hot hot of a take that is anymore.

You don't have to to use the CLI, use what makes you feel comfortable, but you are simply factually wrong that CLIs are only good for scripting or whatever and not humans. I get just not wanting to take the time to learn a tool, after 20 years I still haven't learned sed and use perl pie instead. But it's silly to ignore the benefits of a tool and take some moral stance on it just because I don't want to take the time to learn it.

smackfu
Jun 7, 2004

I don’t care how you use git, but I constantly run into people who:
* don’t know how to fix a typo in a commit message if it’s not the most recent one
* end up with random files in their commits and they don’t know who added them
* have no sense of how to partially revert a commit

All of which are medium complexity things they come up regularly.

StumblyWumbly
Sep 12, 2007

Batmanticore!
Maybe there's stuff I'm completely missing, but understanding add vs commit vs push/pull shows you get the model. The big issue is the way git has the local vs remote repos, so what you think of as main may not be what other people have.

Submodules are weird to use but simple in theory, and other stuff are just specific tools that build on the existing model.

E: doesn't changing a pushed commit add complexity for other folks? Seems not worth doing to fix a typo

Xarn
Jun 26, 2015
Only if it is in a shared branch. In pushed but exclusive branch (usually PRs), it doesn't hurt anyone.

Clanpot Shake
Aug 10, 2006
shake shake!

I prefer the git CLI, but I'm also the weirdo doing a bunch of other poo poo on the command line. I chalk it up to preference

smackfu posted:

I don’t care how you use git, but I constantly run into people who:
* don’t know how to fix a typo in a commit message if it’s not the most recent one
* end up with random files in their commits and they don’t know who added them
* have no sense of how to partially revert a commit

All of which are medium complexity things they come up regularly.


Send them this: the git fuckup CYOA

Harriet Carker
Jun 2, 2009

The CLI/GUI distinction is not the important part here. The main issue is understanding the underlying model and knowing how to get out of an unintended state. If you can do that with the CLI, cool. If you can do that with your favorite desktop GUI tool, cool. The important part is to understand what a commit it, how remotes work, how branches work, how to understand the log, the difference between staged and unstaged files, and so on.

That being said, the best way to get good at git is just to screw up enough times, panic, get expert help, and eventually internalize the troubleshooting process.

Fellatio del Toro
Mar 21, 2009

I work in command line all the time and I can only do like 4 things in git without having to google it, and tbh not that many more actual linux commands despite using it all the time lol

The Dark Souls of Posters
Nov 4, 2011

Just Post, Kupo
I learned the most about git when I nuked a remote branch and had to figure out how to fix it with an interactive rebase (my memory is a little vague of what I actually did). Everyone should learn to use git by destruction.

Less jokingly, I found the CLI a much better tool for understanding the model of git, but that’s anecdotal. Also, nvim over any ide because why not throw that in there.

captkirk
Feb 5, 2010
Nothing teaches you about git like horking the local working copy of a multi terabyte monorepo and knowing it would take all day to clone a new working copy from the remote.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
It took me years to get over the hump with git commands that have '--' in them because I didn't realize that's a convention for "and now we have subcontextual command line arguments to give to everything that was sprayed left of here."

Something I hate about the Linux kernel culture locally here is sending patches without specifying a base commit hash. I don't care if it's master. Whose master? When? Even better when I tell them the commit hash I used and they come back saying they couldn't figure out how to apply it (even though they were the ones who told me to send them a patch). They just slapped it on their master and it puked. Amazing.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


captkirk posted:

Nothing teaches you about git like horking the local working copy of a multi terabyte monorepo and knowing it would take all day to clone a new working copy from the remote.

Protip: if you run a recursive find/replace from the command line in the root directory of a git repo, it will touch files in .git and at that point your copy is unrecoverable.

Cup Runneth Over
Aug 8, 2009

She said life's
Too short to worry
Life's too long to wait
It's too short
Not to love everybody
Life's too long to hate


FlowerRhythmREMIX posted:

I learned the most about git when I nuked a remote branch and had to figure out how to fix it with an interactive rebase (my memory is a little vague of what I actually did). Everyone should learn to use git by destruction.

This is true. I wouldn't know nearly as much about git if I hadn't hosed things up and desperately scrambled to fix them. Just don't make your fuckups somebody else's problem.

Vulture Culture
Jul 14, 2003

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

ultrafilter posted:

Protip: if you run a recursive find/replace from the command line in the root directory of a git repo, it will touch files in .git and at that point your copy is unrecoverable.
In most cases it's probably fine, because Git object files are gzip-compressed and you're unlikely to repeat a realistic search pattern. Definitely dicey if you're replacing strings of a couple characters, or if you hit your config or pre-commit hooks. Obviously, try not to do it.

Ither
Jan 30, 2010

Thankfully, I haven't had to do anything with Git beyond the happy path. I would be at a lost.

For instance, I know there's a command called rebase. But what does it do and in what situation would I use it?

Cup Runneth Over
Aug 8, 2009

She said life's
Too short to worry
Life's too long to wait
It's too short
Not to love everybody
Life's too long to hate


You use it to horrifically gently caress up your repo with a force push edit commit messages/summaries, drop unwanted commits, and squash multiple commits into one, mostly.

Obfuscation
Jan 1, 2008
Good luck to you, I know you believe in hell
I've tried maybe half dozen git gui tools and it's crazy that all of them made interactive rebases way more difficult than the cli

AlphaKeny1
Feb 17, 2006

What's cherry picking and how is it different from rebasing?

Macichne Leainig
Jul 26, 2012

by VG

Obfuscation posted:

I've tried maybe half dozen git gui tools and it's crazy that all of them made interactive rebases way more difficult than the cli

Sublime Merge one of them? It's one of the few that I still like. I've tried GitKraken, Fork, you name it. Always go back to smerge.

NFX
Jun 2, 2008

Fun Shoe

AlphaKeny1 posted:

What's cherry picking and how is it different from rebasing?

It's the same thing just done from different perspectives

Also branches are just pointers

Now you know git

Average Lettuce
Oct 22, 2012


When I worked on a Mac, I used sourceTree and never understood why someone would use the CLI. When I switched to a Linux distro, all the GUIs I could find sucked so much, it was just easier to learn the CLI (which, tbh, isn't very difficult, it's almost 1 for 1 what you do in the GUI, just with commands).

Vulture Culture
Jul 14, 2003

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

AlphaKeny1 posted:

What's cherry picking and how is it different from rebasing?
Rebasing is the general name for rewriting some part of your history, then reapplying all the changes descended from the rewritten part. It changes a bunch of your commit IDs, which means it will no longer be possible to reconcile your version of the branch's lineage against any other version which has the old commit IDs you edited out. So in general, rebasing is something you only do with local changes you haven't pushed anywhere, unless there's some extreme circumstance where you need to invalidate every other copy of the branch floating around in the world.

Cherry-picking just takes an existing commit from someplace and applies it onto your current branch as a new commit, as though you had just made that commit onto your current branch in the first place. You would cherry-pick if you wanted to, for example, land a fix from trunk onto a hotfix branch for a release, or vice versa, without merging all the commits from the entire branch.

Vulture Culture fucked around with this message at 20:55 on Feb 21, 2023

smackfu
Jun 7, 2004

Somehow I always pick the wrong choice between “cherry-pick” and “cherrypick”. Even right now, no idea which is right.

Hughlander
May 11, 2005

ultrafilter posted:

Protip: if you run a recursive find/replace from the command line in the root directory of a git repo, it will touch files in .git and at that point your copy is unrecoverable.

But then you get to learn about zfs snapshots!

The Dark Souls of Posters
Nov 4, 2011

Just Post, Kupo
You use rebase to clean up your local branch before pushing to remote for code review so they can’t see how many committees it took for you to fix that typo

Harriet Carker
Jun 2, 2009

Or you can just use a single commit and amend as you go along. Multiple commits is better for rollback-ability though.

The Dark Souls of Posters
Nov 4, 2011

Just Post, Kupo
I have started amending commits more often now, but there is something satisfying about an interactive rebase and using fixup

The Fool
Oct 16, 2003


git add .; git commit --amend --no-edit; git push --force

The Dark Souls of Posters
Nov 4, 2011

Just Post, Kupo
I’ve always used —force-with-lease

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Vulture Culture posted:

Rebasing is . . .

Cherry-picking . . .
I mean, that's true, but if the OP was just screwing around, then I guess the idea is you can rebase by incrementally cherry-picking until you've built up whatever you wanted.

FlowerRhythmREMIX posted:

I have started amending commits more often now, but there is something satisfying about an interactive rebase and using fixup

I agree but I had to strip a suggested procedure out of a document I wrote locally because that completely destroyed brains and they chose to instead drop the document and just cowboy everything. Well, that was inevitable and if it weren't that, it would be something else, but I had their attention up until that point.


FlowerRhythmREMIX posted:

I’ve always used —force-with-lease

Today I learned . . .

The Fool
Oct 16, 2003


FlowerRhythmREMIX posted:

I’ve always used —force-with-lease

its safer yeah, but most of the time I'm on my own branch and don't have to worry about blowing away other peoples work until I have to resolve merge conflicts

biceps crimes
Apr 12, 2008


I've been using ChatGPT a lot over the past couple weeks. It's not all-devs-are-fired good, but I can paste in little code snippets i anonymize and ask it if it there's a refactor opportunity it sees for rubber ducking, or ask it to add comments to what the code does, and it's been super helpful. It's also been better for a lot of things I would search google for too, like the name of a method in a library, etc. It's great for doing some of the stuff that's time consuming but not particularly difficult (like adding code comments). It's not at the level where I can just copy paste everything it outputs, as it is often wrong and almost always redundant, but it's still making me more productive.

I wouldn't go through pasting all of our files in there for comments, since most of that is low value and obvious stuff, but it's been useful for scripts in dusty corners of some apps we own and barely touch, or some scripts that are used in CI and are difficult for all of the folks who are afraid of the build to go parse, use and maintain. Also good for documentation and how-to stuff, where you need some definitional table setting for explaining things to someone who is totally new. Again, needs a lot of editing, but better than staring at a blank page with a blinking cursor.

It's also great for slack announcements when I'm turning a thing on and I need something phrased in a generic, friendly corporate voice. I kind of hate how useful it's been and how I keep using it more and more every day. I'm wondering if I should be using GitHub's co-pilot for some of this stuff instead, with the understanding that much of its output is unusable and all of the caveats and conditions that apply.

biceps crimes fucked around with this message at 02:21 on Feb 22, 2023

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
--force-with-lease should be the default and regular --force should be an extremely unusual thing to need.

Canine Blues Arooo
Jan 7, 2008

when you think about it...i'm the first girl you ever spent the night with

Grimey Drawer
I've been using ChatGPT mostly for medium complexity syntactical questions, and some random debugging. It does a very decent job in general, and while it sometimes has errors, it's close enough that I can plug the holes myself. It's more or less replaced Stack Overflow for me.

prom candy
Dec 16, 2005

Only I may dance
It's pretty decent at making GBS threads out unit tests

Sistergodiva
Jan 3, 2006

I'm like you,
I have no shame.

Works great for generating typescript types from json responses. Also feels like it gives good explanations and not just code snippets.

Mega Comrade
Apr 22, 2004

Listen buddy, we all got problems!
Eh I've seen it respond with such glaring errors I just don't trust it with anything.

On a side note for those who do like it, would you be willing to pay for it? They claim they want to keep a free tier but it's still during the hype phase, I see that going.
The current trial sub is $20 a month.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.
The thing that scares me the most about chatgpt is how effortlessly it destroys leetcode/hacker rank questions. I don't envy people trying to do remote interviews of coders post chatgpt.

Xarn
Jun 26, 2015

Plorkyeran posted:

--force-with-lease should be the default and regular --force should be an extremely unusual thing to need.

Agreed, sadly one of those things was implemented first and now everybody uses it, and it is not the longer option.

FlowerRhythmREMIX posted:

I have started amending commits more often now, but there is something satisfying about an interactive rebase and using fixup

git commit --fixup {commit} and then git rebase -i --autosquash

Adbot
ADBOT LOVES YOU

Mega Comrade
Apr 22, 2004

Listen buddy, we all got problems!
Update

I've got some semblance of a working Master now. And the idiot Dev provided me with the changes he has to get out cherry picked, so this release can go out. Finally, light at the end of the tunnel.

Let's just test deploy...SQL time out....


"...Did you test this script before you gave it to me?"

"No"



I feel really sorry for his line manager, she's only been in the position a week today.

Mega Comrade fucked around with this message at 12:34 on Feb 22, 2023

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