Skip to content

Instantly share code, notes, and snippets.

@remigijusj
Created April 18, 2016 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remigijusj/6e1f66ef6c3ca078c571d22fb7d7e107 to your computer and use it in GitHub Desktop.
Save remigijusj/6e1f66ef6c3ca078c571d22fb7d7e107 to your computer and use it in GitHub Desktop.
My GIT aliases
[alias]
s = !git status
k = !gitk
br = !git branch
co = "!f() { git checkout `git locax $1`; }; f"
ff = !git reset --hard origin/`git this`
ffm = !git push . origin/master:master
new = !git checkout -b
brd = "!f() { git branch -D `git loca $1`; }; f"
grab = !git fetch origin -p
home = !git checkout master
this = !git symbolic-ref --short HEAD
jump = "!f() { git stash save && git ff && git stash pop; }; f"
fork = "!f() { branch=$(git remo $1); git checkout --track -b $branch origin/$branch; }; f"
loca = "!f() { git branch -l | grep \"$1\" | head -n 1 | cut -b 3-; }; f"
remo = "!f() { git branch -r | tail -n +2 | grep \"$1\" | head -n 1 | cut -b 10-; }; f"
locax = "!f() { branch=$(git loca $1); if [ -z $branch ]; then echo \"$1\"; else echo \"$branch\"; fi; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment