DEV Community

Dmitry Doroshev
Dmitry Doroshev

Posted on • Originally published at dev.doroshev.com

Fast commit and push

I want to share a shell-function called gacp (Git Add, Commit and Push), which I came up with a few months ago and have been using about every hour since then:

# fish
function gacp
    git add .
    git commit -m "$argv"
    git push origin HEAD
end
Enter fullscreen mode Exit fullscreen mode
# bash/zsh
function gacp() {
    git add .
    git commit -m "$*"
    git push origin HEAD
}
Enter fullscreen mode Exit fullscreen mode

Usage example:

> gacp add some new crazy stuff
[master fb8dcc9] add some new crazy stuff
 <...>
Enumerating objects: 12, done.
 <...>
To github.com:foo/bar.git
   912c95d..fb9dcc9  master -> master
Enter fullscreen mode Exit fullscreen mode

No more chains with && and quotes for verbose messages!

Top comments (0)