Skip to content

Instantly share code, notes, and snippets.

@guysmoilov

guysmoilov/.gitconfig

Last active Feb 11, 2021
Embed
What would you like to do?
My git aliases. Work in progress.
[alias]
br = branch
sh = show
rb = rebase
rbi = rebase -i
st = status
ci = commit
cim = commit -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