Skip to content

Instantly share code, notes, and snippets.

@eduncan911
Created October 10, 2014 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduncan911/cd250bc78a4465c3b719 to your computer and use it in GitHub Desktop.
Save eduncan911/cd250bc78a4465c3b719 to your computer and use it in GitHub Desktop.
'git rebase' instead of 'git pull'

Sourced from: http://kernowsoul.com/blog/2012/06/20/4-ways-to-avoid-merge-commits-in-git/

$ # from an individual repo
$ git config branch.master.rebase true

$ # or, set it globally (only works for new repos forward)
$ git config --global branch.autosetuprebase always

If needing to go back and set all branches to rebase by default, run this bash script.

#!/bin/bash

for d in */ ; do
  if [[ -d $d ]]; then
    # change directory 
    pushd "$d" > /dev/null 2>&1
    # set it
    git config branch.master.rebase true
    popd > /dev/null 2>&1
  fi
done

echo "Completed."
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment