Created
March 31, 2017 11:27
-
-
Save steinkel/59dd3490793ac424dac3d806521cae0c to your computer and use it in GitHub Desktop.
my git commit alias
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
# Installation: add this to your .bash_aliases or .zshrc | |
# change the following line to point your phpcbf preferred tool | |
alias phpcbf3="/home/steinkel/phpcs-cake3/vendor/bin/phpcbf --standard=CakePHP" | |
# gitco function | |
# allow commit and comment with no quotes | |
# adds refs #id based on current feature/issue/hotfix branch | |
# run phpcbf on touched files | |
function gitco () { | |
revision=`git rev-parse --abbrev-ref HEAD | sed -n '/feature\//s///p'` | |
if [[ ! $revision ]] | |
then | |
revision=`git rev-parse --abbrev-ref HEAD | sed -n '/issue\//s///p'` | |
fi | |
if [[ ! $revision ]] | |
then | |
revision=`git rev-parse --abbrev-ref HEAD | sed -n '/hotfix\//s///p'` | |
fi | |
if [[ ! $revision ]] | |
then | |
git commit -m "$*" | |
else | |
git commit -m "refs #$revision $*" | |
fi | |
if [ -d "src" ]; then | |
phpcbf3 `git diff-tree --no-commit-id --name-only -r HEAD` | |
git add `git diff-tree --no-commit-id --name-only -r HEAD` && git commit -m 'fix cs' | |
fi | |
} | |
function gitme () { | |
git merge --no-ff "$1" | |
} | |
export gitme | |
export gitco |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment