Skip to content

Instantly share code, notes, and snippets.

@veritech
Created May 27, 2015 14:05
Show Gist options
  • Save veritech/852b5cd089cf4f46503b to your computer and use it in GitHub Desktop.
Save veritech/852b5cd089cf4f46503b to your computer and use it in GitHub Desktop.
Mirror a repo, Update a remote copy, while stripping history
#!/usr/bin/env bash
SOURCE_REPO="" #ie. [email protected]:veritech/FRCoreDataOperation.git
DESTINATION_REPO="" #[email protected]:veritech/mirror.git
FORMATTED_DATE=`date +"%B %d %Y"`
# Get the head of the mirror repo
git clone $DESTINATION_REPO mirror
# Get the head of the of the source repo
git clone --depth 1 $SOURCE_REPO original
# Copy the contents over
rsync -avr --progress original/ mirror --exclude .git
# Go the mirror
cd mirror
# Add all the files
git add -A
#
git commit -m "$FORMATTED_DATE release"
git push origin master
cd ..
rm -rf orginal
rm -rf mirror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment