Last active
August 6, 2018 20:27
-
-
Save olix0r/71310b3fef078cda7a3a to your computer and use it in GitHub Desktop.
git-unfuck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
if ! klist -t 2>/dev/null >&2 ; then | |
echo ":; :; kinit --keychain" | |
kinit --keychain | |
fi | |
branch=$(git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/\* \(.*\)/\1/') | |
if [ -z "$branch" ]; then | |
echo "Could not parse branch" >&2 | |
exit 1 | |
else | |
if [ $branch != "master" ]; then | |
echo ":; :; git co master" | |
git co master | |
fi | |
echo ":; :; git fetch origin master" | |
git fetch origin master | |
echo ":; :; git pull origin master" | |
git pull origin master | |
if [ $branch != "master" ]; then | |
echo ":; :; git co $branch" | |
git co $branch | |
echo ":; :; git merge --no-ff master" | |
git merge --no-ff master | |
fi | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
if ! klist -t 2>/dev/null >&2 ; then | |
echo ":; :; kinit --keychain" | |
kinit --keychain | |
fi | |
root=`git rev-parse --show-toplevel` | |
echo ":; :; git fetch" | |
git fetch | |
echo ":; :; git remote prune origin" | |
git remote prune origin | |
echo ":; :; git repack -a -d --depth=250 --window=250" | |
git repack -a -d --depth=250 --window=250 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment