Skip to content

Instantly share code, notes, and snippets.

@guysmoilov
Last active September 13, 2022 10:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guysmoilov/24b00c1a16079887a870ffe9ebd0472b to your computer and use it in GitHub Desktop.
Save guysmoilov/24b00c1a16079887a870ffe9ebd0472b to your computer and use it in GitHub Desktop.
My git aliases. Work in progress.
[alias]
br = branch
sh = show
rb = rebase
rbi = rebase -i
st = status
ci = commit
cim = commit -m
cia = commit -a -m
co = checkout
rs = reset
uncommit = reset --soft HEAD~1
rollback = reset --hard HEAD~1
conf = config
gconf = config --global
mrg = merge
cln = clone
clnossl = clone -c http.sslVerify=false
nossl = conf http.sslVerify false
graph = log --graph --oneline
graphall = log --graph --oneline --all
mvbr = branch -f
shbr = rev-parse --abbrev-ref HEAD
psh = push
pshu = push -u
pushu = push -u
ad = add
amend = commit --amend
#!/bin/sh
set -e
git add .
git commit -am "$1"
#!/bin/sh
# Usage: Put git-pshbr somewhere in your PATH, then use it like so:
# git pshbr [remote]
# Will push the branch you're currently on to a new branch with the same name on origin, and set the local branch to track it
git push -u ${1:-origin} $(git shbr)
#!/bin/sh
# Usage: git pullco branchname [origin]
# Will fetch from origin, move the local branch to the new commit fetched from origin, and then check it out
set -e
REMOTE=${2:-origin}
git fetch "$REMOTE"
git mvbr "$1" "$REMOTE/$1"
git checkout "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment