every git command I use
Conversation
Notices
-
Embed this notice
Julia Evans (b0rk@social.jvns.ca)'s status on Thursday, 07-Dec-2023 05:06:34 JST Julia Evans -
Embed this notice
Ben Ramsey (ramsey@phpc.social)'s status on Thursday, 07-Dec-2023 05:07:44 JST Ben Ramsey @jamalix @b0rk `git mv` is essentially for renaming a file that’s already in the git repository. It might technically be the same as `git rm old_filename` and `git add new_filename`, but I’m not sure of that.
-
Embed this notice
Felix (jamalix@layer8.space)'s status on Thursday, 07-Dec-2023 05:07:54 JST Felix @b0rk Never seen `git mv` before, gonna look it up!
I like using `git checkout -` to go back to the previous branch. -
Embed this notice
Ben Ramsey (ramsey@phpc.social)'s status on Thursday, 07-Dec-2023 05:13:53 JST Ben Ramsey @u24 @jamalix @b0rk In my experience, it doesn’t always work that way, and sometimes, when I do the rm/add combo, `git status` figures out that I’m actually moving the file and shows it as such, so I’m not sure what’s going on there.
-
Embed this notice
John Marshall (johnm@genomic.social)'s status on Thursday, 07-Dec-2023 06:15:45 JST John Marshall @u24 @ramsey @jamalix @b0rk This was one of my biggest confusions when I first started with git: it IS the same. Recording the fact of the rename is just an illusion provided by the diff mechanism searching for similar text in differently named blobs. See the diff -M option and friends, and config diff.renames et al.
-
Embed this notice
clacke (clacke@libranet.de)'s status on Thursday, 07-Dec-2023 22:27:02 JST clacke @b0rk Yeah in my use most of what I run is aliases so I wouldn't present very useful statistics.
I'm guessing my most used if you trace the aliases would be fetch, then commit, then rebase. Push is usually inside an interactive rebase and wouldn't be in shell history.
-
Embed this notice
Julia Evans (b0rk@social.jvns.ca)'s status on Thursday, 07-Dec-2023 22:27:03 JST Julia Evans here is a highly unscientific graph of the most popular git commands, from the responses to this survey https://forms.gle/ZMmjcDf8fhFnNfaM7
some commands (checkout, commit, status) are underrepresented because people like to use aliases for them
50% of people who answered use 22 or more git subcommands, though sampling bias etc etc
(5/?)
-
Embed this notice
Julia Evans (b0rk@social.jvns.ca)'s status on Thursday, 07-Dec-2023 22:27:04 JST Julia Evans ok I made a quick survey about which git commands you use, it's literally 1 question (run `history | grep -Eo '^(git\s+[^ ]*)' | sort | uniq -c | sort -rn` and paste the output)
if enough people fill it out I will make some highly unscientific graphs
https://forms.gle/fQjQVxhQrQdu4Cd8A
(4/?)
-
Embed this notice
Julia Evans (b0rk@social.jvns.ca)'s status on Thursday, 07-Dec-2023 22:27:06 JST Julia Evans i'm kind of curious about what people mean when they say "i just use 5 git commands", my best guess is that there are 5 main "stressful" commands (maybe commit, merge, rebase, push, and pull) and that's what folks are thinking of
(3/?)
-
Embed this notice
Julia Evans (b0rk@social.jvns.ca)'s status on Thursday, 07-Dec-2023 22:27:08 JST Julia Evans feels hard to argue that git is easy to learn when i use at a minimum 20 different git subcommands, each of which has its own weird gotchas
(2/?)
-
Embed this notice
clacke (clacke@libranet.de)'s status on Thursday, 07-Dec-2023 22:27:13 JST clacke hmm, looking at the top commands I realize I missed log, diff and blame.
I will do the stats and unalias my aliases in the results. I'm curious now, maybe I'll surprise myself.
-
Embed this notice
clacke (clacke@libranet.de)'s status on Thursday, 07-Dec-2023 22:27:13 JST clacke @ondrej @b0rk I have learned within the last year that restore is not just a better named subset of checkout, it can do things checkout can't, so I use it quite a lot in commit surgery these days. -
Embed this notice
Ondřej Surý (ondrej@mastodon.rfc1925.org)'s status on Thursday, 07-Dec-2023 22:27:14 JST Ondřej Surý @b0rk Interesting! I’ve never used `git switch` nor `git restore`, but I use `git autosquash` (alias to `git rebase -i --autosquash`) and `git pushf` (alias to `git push --force-with-lease`) almost every day. I also find `git checkout -` very helpful.
And `git yolo` = `!git commit -m \"$(curl -s https://whatthecommit.com/index.txt)\"` for when “WIP” is not enough as commit message ;).
-
Embed this notice
Ondřej Surý (ondrej@mastodon.rfc1925.org)'s status on Thursday, 07-Dec-2023 22:27:18 JST Ondřej Surý @b0rk Pair it with `git commit --fixup=amend:<ref>` if you want to change the commit message in a previous commit.
My WIP branches are usually full of normal and amend fixup commits as I improve on things, henceforth autosquash is a lifesaver for me!
clacke likes this. -
Embed this notice
Julia Evans (b0rk@social.jvns.ca)'s status on Thursday, 07-Dec-2023 22:27:19 JST Julia Evans @ondrej TIL autosquash thanks
-
Embed this notice
clacke (clacke@libranet.de)'s status on Thursday, 07-Dec-2023 22:27:21 JST clacke @ondrej @b0rk I run `git rebase --interactive --autosquash --rebase-merges` many times per day, it's brilliant when you have multiple changes going on.
-
Embed this notice