Skip to content

Instantly share code, notes, and snippets.

@jtremback
Created December 30, 2017 01:39
Show Gist options
  • Save jtremback/fae923212aa442b86cda305af790a387 to your computer and use it in GitHub Desktop.
Save jtremback/fae923212aa442b86cda305af790a387 to your computer and use it in GitHub Desktop.
#!bash
set -eux
cd "$1" || exit
# git remote rm origin
CONTENTS="$(ls) .gitignore"
mkdir -p "$1"
git mv -- $CONTENTS "$1/."
git commit -m "Prepare $1 to merge into $2"
cd "../$2" || exit
git remote add "$1" "../$1"
git pull "$1" master --no-edit --allow-unrelated-histories
git remote rm "$1"
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment