Hacker News new | ask | show | jobs
by evilc00kie 992 days ago
Ctrl+R is insane but sometimes I have a hard time remembering flags due to overusing it. Especially when crafting new pipelines/solving new problems.

But I'd always alias some uncommon tasks and usages. Especially my quirky git ones:

  # get default branch
  alias gdefault='git remote show origin|grep -E HEAD|cut -d" " -f5'

  # cd to git root
  alias groot='cd "$(git rev-parse --show-toplevel)"'

  # Revert last unpushed commit to the state before commiting
  alias uncommit="git reset HEAD~1 --soft"

  # Show all commits between head and main as one-liner
  alias gl1="git log --reverse --oneline HEAD...\`gdefault\`"
1 comments

Funny, I was just learning about Git revision ranges the other day, to get to something like the last one! Thanks for sharing.