Hi, I am Li Hau 😁

git

git cheatsheet for zsh

link

  • setup & update 👨🏻‍🔧

  • inspect & compare 🕵🏻

  • work! 👩🏻‍💻

  • troubleshooting 🐛

  • merge & branch manipulation 👰🏻🤵🏻

  • housekeeping 🚮

git fetch --all --prune

gfa

setup & update 👨🏻‍🔧

git pull --rebase

gup

setup & update 👨🏻‍🔧

git checkout -b branch

gcb

setup & update 👨🏻‍🔧

git branch -m new_name

setup & update 👨🏻‍🔧

git checkout branch

gco

setup & update 👨🏻‍🔧

git branch | grep xxx

gb | grep xxx

setup & update 👨🏻‍🔧

git branch --remote | grep xxx

gbr | grep xxx

setup & update 👨🏻‍🔧

git status

gst

inspect & compare 🕵🏻

git log

inspect & compare 🕵🏻

git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

aliased to glol

inspect & compare 🕵🏻

glol --first-parent

inspect & compare 🕵🏻

glol filename.js

inspect & compare 🕵🏻

git show 2a7e103824

inspect & compare 🕵🏻

git add

work! 👩🏻‍💻

git rm

work! 👩🏻‍💻

git mv

work! 👩🏻‍💻

git diff

gd

work! 👩🏻‍💻

git diff --name-only

work! 👩🏻‍💻

git commit

gc

work! 👩🏻‍💻

git commit --all --message "message"

gcam

work! 👩🏻‍💻

git commit --all --amend --no-edit

gcan!

work! 👩🏻‍💻

git reflog

troubleshooting 🐛

git rebase

merge & branch manipulation 👰🏻🤵🏻

git cherry-pick

merge & branch manipulation 👰🏻🤵🏻

git stash

gsta

merge & branch manipulation 👰🏻🤵🏻

git merge

gm

merge & branch manipulation 👰🏻🤵🏻

git push

gp

merge & branch manipulation 👰🏻🤵🏻

git push --set-upstream origin branch

gpsup
merge & branch manipulation 👰🏻🤵🏻

git push --force origin branch

merge & branch manipulation 👰🏻🤵🏻

git remote prune origin

housekeeping 🚮

git branch --merged | xargs git branch -d

housekeeping 🚮

git clean -df

gclean

housekeeping 🚮

git gc --aggressive

housekeeping 🚮

git good && git commit

@react-dev #git-good

git

By Li Hau Tan