95% of the time all you need to know about git is add, commit, push, and pull. maybe log if you want to see a list of commits
but then the other 5% of the time it’s suddenly like
!!! you didn't transverse the planes before ancilpating the forward inverse!! entering CRITICAL DATA RECOVERY MODE NOW!!!
and I’m like “uhh uhh uhh” *frantically googles and copy-pastes a command that looks like git refdraft -qXR hdd::~475.2* “phew! that either fixed it or corrupted everything!”
version control is the best
@kasdeya I fucking hate git cuz the one time you use a command you use prolly 1 every 20 full moons, is what makes you hit your head against a brick wall.
@kasdeya yeah, and then because of the experience you try to learn more about Git, and it makes total sense! But you've completely forgotten it by the time you need it again
@kasdeya 100%, and also I bookmarked this recently because I trust @b0rk more than seo randos. https://git-scm.com/cheat-sheet.html
@kasdeya After having this experience one too many times, I broke down and read the book: https://git-scm.com/book/en/v2 #git
@kasdeya the best part is when you breathe a sigh of relief that it worked and then realize that you’re actually in the wrong branch because you were so nervous you forgot to change branch to the one you actually wanted to change.
@aspensmonster I did one better. I just bought the book and put it in front of me unopened. I figure if I buy the book, it will protect me from needing any information inside it.
@kasdeya reminds me of an oldie, but goodie. The fake git command line generator is hilarious https://git-man-page-generator.lokaltog.net/#a25vY2skJG1haWxib3g=
@kasdeya This is absolutely true. BUT ALSO, it is like this all the way down. I use reflog, rebase, cherry pick and even branch filter like I was born with a neckbeard, but I also get the five percent explosion thing, only different coloured smoke.
@kasdeya Pretty much 100% this. Also the fact that it takes surprisingly long to understand what one is reading from https://git-man-page-generator.lokaltog.net is a proof of something 😄.
"git-soak-clone soaks downstream clones next to most quiltimported commit graphs."
Entirely plausible.
@kasdeya right, but the upside is that sometimes you get to literally REPAIR THE TIMELINE and that feels like the coolest thing ever
”
% rm -fr .git
% git init
% git add -a
% git commit -m sigh
% git push --force
% zork
@kasdeya
One more for you:
git reflog
It shows everything you did, with commit ids, even deleted ones. And as long as git gc doesn't run, all of those still exist. Messed something up completely? Use git reflog to find the last good commit id and create a new branch from that id. Even if that was from a deleted branch.
@kasdeya the problem is that objectively the worst version control system of its generation became the most popular and eliminated all competition 😐
@kasdeya this brings back memories of coaxing a colleague to relax about "detached HEAD mode" because the built in message about that was way too alarmingly written.
@kasdeya and then you use Mercurial and you it’s like `hg thing-you-wanted --obvious-params`, and you don’t need to copy paste arcane incantations, and the commands are discoverable, and man pages simple and not novel-length, and there are sunshine, rainbows, and no screaming, and you wonder how that git shit ever caught on
@kasdeya I use Mercurial and hg-git.
It makes things much simpler, in cases where you are not dealing with ultra-fancy Git repo designs. The main problem is prepping a large Git repo can take days, because Mercurial is VERY SLOW. Also it does not support things like ‘depth one’ or checking out just a branch.
A Git branch isn’t even the same as a Mercurial branch. It is roughly the same as a Mercurial bookmark. So you have to handle them as bookmarks, when using hg-git.
@kasdeya I do kinda miss the judgemental finger-wag I would get from Stack Overflow wonks anytime I didn't remember the right magical incantation to undo something in git.
ChatGPT ruined everything.
@kasdeya
```
cp changedfile /tmp
cd ..
rm -rf $project
git clone $giturl
cd $project
cp /tmp/changedfile .
git add .
```
🥳
@joriki @kasdeya nice resource! I’ll also suggest https://wizardzines.com/zines/git/ by the amazing @b0rk
@kasdeya please don't damn all version control by the absolute fsckery that is git
@kasdeya hah!
and really it could be explained a LOT better, too
like, it feels like a lot of people don't know that branches are basically just tags that move around, and if you know that it helps a ton
but yeahh there's an entire back corner full of obscure git commands that are super useful sometimes but nobody's ever heard of
(I'd add git reset to the list of essentials, maybe stash, there's some useful day-to-day stuff too)
@kasdeya Also git mergetool needs to die in a fire. I just open up the conflicty files manually and search for <<<<<<<. Way easier to understand than whateverthehell mergetool is showing. (Though that might be vim's fault. It doesn't really do four-way diffs that well.)
@kasdeya when you're trying to solve a merge conflict but end up reading esoteric Dutch papers on graph theory to understand exactly how fucked you are
ᅠ ᅠ ᅠ ᅠ ༽
@kasdeya whenever i encounter these 5% i resort to this trusty website: https://git-man-page-generator.lokaltog.net - it never let me down!
@markusr I wish people wouldn't make this joke (and there are a *lot* of people making it in this thread!) because Git, unlike many older version control systems, actually does provide the tools to diagnose and fix most problems, and fixing problems is a great way to learn about the system and thereby ascend to Git Nirvana. They may all have stupid and/or unguessable names, but they're there. https://dangitgit.com/en is a great resource for unsticking yourself.
@tarix29 @pmmeurcatpics @kasdeya I’m grateful for @b0rk’s zine How Git Works, which has really helped me straighten out my understanding of git. https://wizardzines.com/zines/git/
@aspensmonster @kasdeya the book is really really good. Folks shouldn’t be scared of it. Also read everything from @b0rk (git related or not)
@kasdeya no, no, you want `git reflog` for this
it is for when you have already flogged the repo at least once and you need to re-flog it, to remind it to behave
@pozorvlak @kasdeya I know Git. I sue Git almost daily. I can solve many "Git problems" myself. I can research / familiarize myself with new solutions and apply them. I even have my own Git cheat sheet. But the thing is: These problems always arise when I focused on something else. When I'm in the focus tunnel, I don't want to deal with Git issues. Then I don't want any distractions. Then the simplest solution, which doesn't distract me, is what counts.
@ewjoachim @kasdeya That is literally the advice I give to folks starting out with git.
I should make a t-shirt "I'm a git expert. If you see me run, try to keep up."