Skip to content

Instantly share code, notes, and snippets.

@jensneuhaus
Created August 10, 2018 16:47
Show Gist options
  • Select an option

  • Save jensneuhaus/6f26ca9a79444589dea63c6a0b90c4ac to your computer and use it in GitHub Desktop.

Select an option

Save jensneuhaus/6f26ca9a79444589dea63c6a0b90c4ac to your computer and use it in GitHub Desktop.
Create a clean commit to another repo (Usage: ./clean_push.sh <repo_name> "this is a new commit")
#!/bin/bash
set -e
echo "Using repository $1"
echo "Using commit message $2"
rm -rf /tmp/git-copy/
mkdir /tmp/git-copy/
git clone $1 /tmp/git-copy/
rsync -r --verbose --exclude '.git' --exclude '.happypack' --exclude 'node_modules' --exclude '.venv' --exclude '.pyc' --exclude '__pycache__' --exclude '.cache' -R . /tmp/git-copy/
cd /tmp/git-copy/
git add .
git commit -m "$2"
git push -u origin master
rm -rf /tmp/git-copy/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment