knowing where you are in git
https://wizardzines.com/comics/knowing-where-you-are-in-git/
knowing where you are in git https://wizardzines.com/comics/knowing-where-you-are-in-git/ 23 comments
@b0rk So I've been dealing with git since 2008, and I've always resisted doing the shell prompt thing -- it seemed like weird customization that never really made sense to me, and took up more space on the screen. This comic is the first argument that has really resonated with me. Getting your model of the git state _wrong_ is just as bad as doing commands in the wrong directory. Well put. @b0rk I recommend Starship shell prompt, which supports lots of shells and shows info related to your current directory out-of-the-box (like git repo details). @ramsey @b0rk ooh--not familiar with that. Any idea how it compares to https://ohmyposh.dev/ ? also I made a claim on this page that I'm not 100% sure of ("with git's shell prompt git-prompt.sh, the only way you can end up with `((a3b2293))` in your prompt is if you explicitly used `git checkout` or `git switch` to check out a commit, tag, remote-tracking branch, etc") the only exception I can think of is "the repo is a submodule of another repo and you ran `git submodule update`", but I'd be interested to hear if there are others @b0rk I subconsciously run git status after every random git thing I do. It is so automated that it doesn't even affect the experience xD @weepingclown @b0rk I mostly interact with git through emacs now, but whenever I do interact with the CLI, I do this pretty much compulsively as well. Do the same thing with 'ls' after cd'ing to a different directory. @splatt9990 @b0rk what are the odds, I run ll almost straight after every cd as well :P (I have alias ll='la -lA') @weepingclown @b0rk my favourite suggestion for helping people with git is _read what git status says_ (e.g. how do i tell what branch i'm on, how do i undo a change i didn't want, what should i do in detached HEAD). It sounds simple, but there is something about the drone-like output of git status that makes it surprisingly hard to read, even when there is critical information in its output. @b0rk Fairly recently I started leaving a terminal tab with lazygit open on whatever Iβm working on. I surprised myself as I thought Iβd probably hate it and never use it given that I am fairly comfortable with common git command line usage (and searching for the rest). I actually really like it and the command lineβs still just on the next tab if I want it. @b0rk ooh thanks, more great advice!was going to say that i rely on the venerable `git-wtf` script for orienting myself wrt remotes too, but looks like it's been unmaintained a long time now π this link seems not to work any more either http://git-wt-commit.rubyforge.org/#git-wtf @b0rk I tried to use sub modules once, and gave up. I thought it would be a nice way to work on whichever thing and a library it uses all in one place, but nothing git did with it made any sense. I hope youβll cover submodules at some point in your git series @b0rk Where does git-prompt.sh live? I can't find it on my system :( thx for all the comics :D @b0rk yeah, you can do it with things like `git checkout HEAD@{0}` but i think that's covered by your "etc". |
@b0rk "la la la..."