DEV Community

Discussion on: 🔱 Git Commands You Didn't Know

Collapse
 
eljayadobe profile image
Eljay-Adobe

My aliases:

st = status -s -uno
co = checkout
coffee = "!f(){ if [ `date -j +%a` = 'Fri' ]; then echo 'Friday! Time for beer!'; else echo 'Time for a coffee break. Go get a cup of joe.'; fi };f"
master = checkout master
rmbr = "!f(){ git branch -d \"${1}\"; git push origin --delete \"${1}\"; };f"
mkbr = "!f(){ local args=\"$*\"; local gituser=$(git config user.email); gituser=${gituser%@*}; if [ \"$args\" = \"\" ]; then args=\"$(date \"+%Y-%b-%d\")\"; fi; args=${gituser:-${USER}}/$args; args=$(echo \"$args\" | tr ' [A-Z]' '_[a-z]'); git checkout -b \"$args\"; };f"
ls = "!f(){ if [ -z \"${1}\" ]; then echo 'git ls [HASH] • show the files involved in the commit'; else git diff --name-only \"${1}^..${1}\"; fi; };f"
at = rev-parse --abbrev-ref HEAD
unstage = restore --staged
unadd = restore --staged
discard = checkout --
alias = config --get-regexp ^alias\\.
d = difftool
ds = difftool --staged
branches = branch --all

git ls hash
— is useful to show the files involved in a commit.

Collapse
 
dephraiim profile image
Ephraim Atta-Duncan

I must say, they are pretty awesome.