Skip to content

Instantly share code, notes, and snippets.

@basicxman
Created July 21, 2012 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basicxman/3156078 to your computer and use it in GitHub Desktop.
Save basicxman/3156078 to your computer and use it in GitHub Desktop.
#!/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