diff options
| author | Miquel Sabaté <mikisabate@gmail.com> | 2013-07-25 11:48:59 +0200 |
|---|---|---|
| committer | Miquel Sabaté <mikisabate@gmail.com> | 2013-07-25 11:48:59 +0200 |
| commit | 52cccd81415f93e8e989c8b73b7843be86092a2c (patch) | |
| tree | 5039e6ca9e78272b601b641459e75719566608e7 | |
| parent | 6b4f63fe0ecfca26d4e4679579f11eaf09fdc281 (diff) | |
| download | dotfiles-52cccd81415f93e8e989c8b73b7843be86092a2c.tar.gz dotfiles-52cccd81415f93e8e989c8b73b7843be86092a2c.zip | |
Added the p function.
This function acts as a shortcut to create a patch file from a git repo.
| -rw-r--r-- | bashrc | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -73,3 +73,19 @@ function g { echo "unknown shortcut" } +# The path for patches. +export PATCH=$HOME/.patches + +# Create a patch and save it to the directory of patches. If the patch +# already exists, it will ask if the user wants to overwrite it. +p() { + path="$PATCH/$1.patch" + if [ -f $path ]; then + echo "The patch \`$1' already exists." + read -p "Do you want to overwrite its contents ? (Y/n) " yn + case $yn in + n | N | no | NO ) exit 1 + esac + fi + git diff > $path +} |
