Created
July 21, 2012 15:10
-
-
Save basicxman/3156078 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# Usage: | |
# To include everything, do not stage beforehand or pass arguments. | |
# Otherwise, stage what you wish to include beforehand and/or pass an argument | |
# here for git add. | |
# | |
# Examples: | |
# deploy-working #=> Stages everything (git add .) and deploys | |
# | |
# git add foo.txt | |
# git add bar.jpg | |
# deploy-working #=> foo.txt and bar.jpg are already staged, deploys them | |
# | |
# deploy-working foo.txt #=> foo.txt gets staged (git add foo.txt), deploys | |
BRANCH=`git symbolic-REF HEAD` | |
REF=`git rev-parse --verify $BRANCH` | |
if [ -z $1 ] | |
then | |
if [ -z `git diff --staged` ] | |
then | |
git add . | |
fi | |
else | |
git add $1 | |
fi | |
git commit --quiet -m 'test commit' | |
git format-patch --binary --stdout $REF > temp.patch | |
git reset --quiet --mixed $REF | |
echo ${BRANCH##REFs/heads/} >> temp.patch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment