isaaclw
10/23/2014 - 6:33 PM

GIT

GIT

# Write, pull, merge, confirm, push. Makes sure your branch is as up to date as possible before you merge/push.
tmpcommit=$(mktemp);
vim $tmpcommit;
git stash && git pull --ff && git merge $1 --no-ff --no-commit &&
cp $tmpcommit .git/MERGE_MSG && git commit --no-verify && git stash pop;
files=$@
patch=$(tempfile)
git diff $files > $patch && git checkout $files && git pull --ff && patch -p1 < $patch && rm $patch
git remote prune origin

# or delete branches:
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
HASH=
FILE=
vimdiff <(git show $HASH~:$FILE) <(git show $HASH:$FILE)