Email or username:

Password:

Forgot your password?
23 comments
cliffle

@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.

Ben Ramsey

@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).

starship.rs

Ben Ramsey

@rpardee @b0rk I havenโ€™t used ohmyposh, so I canโ€™t really offer any opinion on how they compare.

Julia Evans

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

Julia Evans

also there are tons of ways to orient yourself in git (you can run `git status` constantly! use a GUI! use a different git prompt like starship!).

it doesn't really matter which way you do it as long as you

a) have a way to know where you are
b) know how to interpret what it's telling you (not always easy!! I've been using the same git prompt for probably 7 years and I didn't fully understand how to interpret it (or git status) until this week!)

(3/?)

also there are tons of ways to orient yourself in git (you can run `git status` constantly! use a GUI! use a different git prompt like starship!).

it doesn't really matter which way you do it as long as you

a) have a way to know where you are
b) know how to interpret what it's telling you (not always easy!! I've been using the same git prompt for probably 7 years and I didn't fully understand how to interpret it (or git status) until this week!)

weepingclown

@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

splatt9990

@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.

weepingclown

@splatt9990 @b0rk what are the odds, I run ll almost straight after every cd as well :P (I have alias ll='la -lA')

David JONES

@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.

Kenneth Freeman

@b0rk Detached HEAD state sounds rather... final...

Stephen Paulger

@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.

Jez ๐Ÿž๐ŸŒน

@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 git-wt-commit.rubyforge.org/#g

Merc

@b0rk Your workflow sounds like it is mostly command-line oriented. Some people never really leave their IDEs.

I wonder how some of the more popular IDEs ensure their users are aware that they're in a special state in Git.

ShadSterling

@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

Sam Cranford

@b0rk Where does git-prompt.sh live? I can't find it on my system :( thx for all the comics :D

David JONES

@b0rk yeah, you can do it with things like `git checkout HEAD@{0}` but i think that's covered by your "etc".

temmie

@b0rk haven't tested it since not at a computer, but suspect you also can via git worktree add --detach

Stu

@b0rk Oh that is awesome. I've definitely checked things in to the wrong branch. I just pulled up the Git Bash terminal (I'm limited with what I can access, on $work machine) and it includes the (branch) thing!

Go Up