remix logo

Hacker Remix

How I Use Git

86 points by BerislavLopac 4 days ago | 27 comments

sshine 10 hours ago

Fascinating, and downright uncanny.

I could have written it.

Now I can share it with others and say "This is 96% me."

  - I use gap instead of gaa. (He also uses git add -p, but no alias?)
  - I didn't have 'git lr', but I do now.
  - I use `git commit --amend` more often.
  - Pull request workflows exactly the same.
  - Same policy on rebasing main onto feature branches.
  - Same behavior around reviewing and self-reviewing.
  - Same tendency to commit and cherry-pick off a branch.
  - ...
My Atuin frequency table for git-specific commands:

  gs  # git status
  gap # git add -p
  gl  # git log
  gc  # git commit (with -m, -v or --amend)
  ga  # git add
  gdc # git diff --cached
  gd  # git diff
  gp  # git push (sometimes with --force-with-lease)
  gco # git checkout
  gpr # git pull --rebase --prune
  git restore
  git config
  git rebase
I actually use Conventional Commits. I spent a total of 5 minutes bike-shedding "chore".

I didn't use "chore" before, because I don't get it, but I care more about consistency than being right.

So with my current colleague, I use "chore" as he does.

Another big difference is: I used `git worktree` extensively in my previous job. I don't now.

I used it extensively in my old job, since I maintained multiple long-lived contexts, and got distracted a lot.

I don't do that recently, so it's probably a work culture thing.

weaksauce 4 days ago

> I use git on the CLI 99.9% of the time. I never used a GUI for git and don’t see a reason to.

Nobody needs a gui for git or a text editor but using magit is like a superpower compared to the command line. It is probably the best piece of software i've ever used. you can even drop down to the command line git inside of it if you need. i don't understand why anyone would prefer the cli over it.

sshine 12 hours ago

I don't use magit, because I don't use Emacs.

But I've seen a magit power user, and arguably:

magit is the only git client I've seen that does some things better than CLI without being severely disempowered.

I only prefer the CLI over magit because I don't use Emacs. I'm not switching back to Emacs because of magit (or org-mode).

LSP is just too big for me, and Emacs has poor LSP, both in rendering, back-end performance, and effort setting it up.

kccqzy 4 days ago

Exactly. My favorite is probably "r s" or rebase subset: it is much more intuitive to use than remembering the order of the refs you pass to `git rebase --onto X Y Z`, and this happens to be something I do a whole lot since I use dependent branches to create dependent PRs.

My second favorite is "c F" or instant fix up.

tempodox 4 days ago

But magit is a plugin for a text editor. No text editor, no magit. And the difference between a TUI and a GUI is only gradual.

weaksauce 3 days ago

I'm not sure your point? I am advocating for magit/a text editor plugin. git itself is not a TUI either like say lazygit is one. if someone were to rip out everything except magit and throw it into a TUI I'd be down to use it but as it is I only use emacs for magit because magit is just that good.

keybored 4 days ago

And you don’t need to a make three dozen shell/git aliases. The keybinds are already good.

eviks 4 days ago

> I use git on the CLI 99.9% of the time. I never used a GUI for git and don’t see a reason to.

Because it shows more information about the state and spares you the trouble of navigating much of the zoo that is git cli design

For example,

> It shows the current branch and whether the repository is dirty, i.e. whether it has uncommitted changes

And the GUI would also show what/where those changes are and allow jumping to edit them. And you'd get updates after you edit even without manually refreshing the prompt

muldvarp 4 days ago

> spares you the trouble of navigating much of the zoo that is git cli design

Yeah. I understand the inner workings of git and am perfectly capable of using git on the command line but the git cli is just so horribly designed. I regularly have to google how to perform rather basic actions because the cli just isn't structured in any sensible way.

bsder 4 days ago

> When someone asks me to help them with some git thing

I point them at jujutsu (jj) and then they simply get on with using source control without the need for 8,000+ articles about navigating the insane Git command line interface.