One GIT command to rule them all (gacp: git-add-commit-push)

I would really love a specialized git alias / bash function that can do the following.

git add -A
git commit -m "$MESSAGE"
git push origin master

All with a single command.

  • Creating a 'git log' alias with formatting
  • What is the point of using git alias?
  • Is it possible to use alias expansion with shell's builtin commands in Git?
  • Adding Git Bash Alias
  • Unable to get aliases work in .gitconfig
  • Is it possible to override git command by git alias?
  • gacp
    > My message

    Can this be done? Could someone share some sample code? Is there a native git function that can do this?

  • Bash Search File for Pattern, Replace Pattern With Code that Includes Git Branch Name
  • Succinct way to create a tracking branch with Git
  • Git post-receive hook not firing external script
  • how to escape special characters in .gitconfig proxy authentication
  • Bash - check for a string in file path
  • What's the most proper way to remove an already deleted branch from tab-completion history?
  • 4 Solutions collect form web for “One GIT command to rule them all (gacp: git-add-commit-push)”

    If you are on linux, just write a shell script or create an alias

    For example.

    set -x  # Output executed commands
    set -e  # Make script fail as soon as one command fails
    read MESSAGE
    git add -A
    git commit -m "$MESSAGE"
    git push origin master

    on my windows machine . i have set up this bashrc alias to make the entire process more simple.

    • create / locate your .bashrc – refer stack overflow thread

    • add the following line to file

      alias gacp=’echo “enter commit message : ” && read MSG && git add . && git commit -m “$MSG” && git push’

    • reload .bashrc / close and reopen your shell

    • now you can do the entire process with gacp command .

    The first two commands can be launch with :

    git commit -a -m "$MESSAGE"

    Then, you can check other commands :

    git pull --rebase 
    git rebase -i

    before to do a git push.

    Refer to the answer here: git add, commit and push commands in one?

    You can try gitu.

    For the first time (node js has to be installed):

    npm install -g git-upload

    After that:

    gitu COMMIT_MSG

    To issue those three commands at once.

    The good thing is that you don’t have to worry when you reinstall your system or when you want to do this on different computers and No file modification is needed.
    This also work on different platforms (not just Linux and Mac, but also Windows) just that you have to install npm and nodejs (git of course).

    Git Baby is a git and github fan, let's start git clone.