Created
August 10, 2018 16:47
-
-
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")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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