Live data from Hacker News

Ask HN: What are some Git aliases you setup that save you time?

news.ycombinator.com

1–10 of 35 posts

Re: Ask HN: What are some Git aliases you setup that save you time?

#6
ga - add

gc - commit

gc! - amend

gcm - checkout master

gco - checkout

gcb - checkout new branch

Rebase:

grb

grbc - continue

grba - abort

Cherry pick:

gcp

gcpc - continue

gcpa - abort

These all are included in zsh git aliases but listed these I'm using on regular basis.

I also have a function that checks out master, pulls it, runs DB migrations and so on.

For longer ones like `g reset --soft HEAD~1` where I cba setting up alias, I just ctrl+r and fetch them with fzf or zsh autosuggestions - probably same amount of keystrokes as typing out alias

Re: Ask HN: What are some Git aliases you setup that save you time?

#7
post #2

I'd always make one for my work dev folder so I could quickly switch to it as soon as I restarted my terminal. I'd always make it just a 2 letter abbreviation. For example, my last one was an alias "s6" to take me the the correct dev folder.

Check out zsh-z, autojump (or any derivative of these)

Re: Ask HN: What are some Git aliases you setup that save you time?

#9
I actually have them documented here and the aliases file is autogenerated whenever I add or update new ones :)

https://jdsalaro.com/note/wrist-friendly-git-shortcuts

I decided against git aliases in favour of shell aliases, but people might still find them interesting.

For me, and my wrists, gs and gf have been game-changing.

Re: Ask HN: What are some Git aliases you setup that save you time?

#10

For anyone new to aliases, you can add them with: alias my_alias="command" Add it to your ~/.bash_profile or ~/.zprofile so it's ready whenever you are. Check out this page for more info: https://linuxize.com/post/how-to-create-bash-aliases/

Okay, but this is about git aliases. Quite similar.
Post reply on HN