Email or username:

Password:

Forgot your password?
Top-level
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

14 comments
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

Go Up