Skip to content

Instantly share code, notes, and snippets.

@techlunacy
Created February 27, 2019 04:17
Show Gist options
  • Save techlunacy/ccd163d2d8f8f72b25848565074dfea1 to your computer and use it in GitHub Desktop.
Save techlunacy/ccd163d2d8f8f72b25848565074dfea1 to your computer and use it in GitHub Desktop.
repository maintinence tasks
git fetch
git remote prune origin
git branch --no-color -r --merged | grep -v master | sed 's/origin\// /' | xargs -n 1 git push --delete origin
git checkout master
git pull
for BRANCH in $(git --no-pager branch --no-color -r --no-merged | sed -e 's/origin\///');
do git checkout $BRANCH ;
git pull
GIT_EDITOR=true git merge --strategy-option theirs origin/master
git reset --hard HEAD
git push origin $BRANCH
done
git checkout master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment