Skip to content

Instantly share code, notes, and snippets.

@nsakaimbo
Forked from orta/fish_lazy_commits.sh
Last active August 9, 2016 19:23
Show Gist options
  • Save nsakaimbo/2e89a844c033d6e25f76fc4eadefed83 to your computer and use it in GitHub Desktop.
Save nsakaimbo/2e89a844c033d6e25f76fc4eadefed83 to your computer and use it in GitHub Desktop.
Shell commands for better commit messages (via Artsy/Orta)
# Lovely little suite of functions to automate better commit messages, from:
# http://artsy.github.io/blog/2016/03/02/Lazily-Automation/
# I'm a zsh user, so I stash these into my home directory,
# and then add the following reference to my .zshrc: source $HOME/git_commit_helpers
function git_branch_info
git branch ^/dev/null | grep \* | sed 's/* //'
end
function branch
git checkout master;
git pull upstream master;
git checkout -b $argv[1]
git config branch.$argv[1].description $argv[2]
end
function commit
set BRANCH (git_branch_info)
set INFO (git config branch.(echo $BRANCH).description)
git commit -m "[$INFO] $argv"
# I would like the ability to selectively add single or multiple specific files to my commits!
# Need to figure out how I can update the last command to do this
end
function context
set BRANCH (git_branch_info)
git config branch.(echo $BRANCH).description $argv[1]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment