Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'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