Skip to content

Instantly share code, notes, and snippets.

@0xGGGGG
Created April 23, 2013 12:08
Show Gist options
  • Save 0xGGGGG/5443043 to your computer and use it in GitHub Desktop.
Save 0xGGGGG/5443043 to your computer and use it in GitHub Desktop.
a bash script to make rebasing default on git-pull
#!/bin/bash
# Makes rebasing default on git-pull
# Run it on the working-git-directory
echo "Existing branch's default action is being updated"
for file in $(find . -type d -name ".git")
do
LENGTH=${#file}
PRPATH="${file:0:LENGTH-4}"
pushd $PRPATH
git for-each-ref --shell --format='git config branch.%(refname:short).rebase true' refs/heads/ | sh
popd
done
echo "Global rebase config is done"
git config --global branch.autosetuprebase always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment