Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- git add .;
- git commit -m "$1";
- STAGED_FILES=$(git diff --name-status --staged);
- while read -r FILE; do
- STATUS=${FILE:0:1};
- FILENAME=${FILE:2};
- if [ "$STATUS" == "M" ] || [ "$STATUS" == "A" ]
- then
- echo "... copying file: ../pathto/$FILENAME";
- cp -r $FILENAME ../pathto/$FILENAME;
- elif [ "$STATUS" == "R" ]
- then
- echo "... removing file: ../pathto/$FILENAME";
- rm -r $FILENAME ../pathto/$FILENAME;
- else
- echo "Fatal error: $STATUS not tracked";
- exit;
- fi;
- done <<< "$STAGED_FILES";
- echo "Pushing to Bitbucket:";
- cd ../pathto/;
- git add .;
- git config user.name ""
- git config user.email ""
- git commit -m "$1";
- git push origin master;
- echo "Pushing to Github:";
- cd ../pathto/;
- git push origin master;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement