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.

  • Git Log Alias not working
  • Meta-alias in Git Bash
  • Creating Git alias that gets the last commit
  • use git shell alias in git command
  • What is the point of using git alias?
  • Git aliases - command line autocompletion of branch names
  • gacp
    > My message

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

  • How to find which actual command is executed in terminal
  • Getting TravisCI to commit and push a modified file with Tags (releases)
  • Using variables assigned with heredoc content in a Bash script via Sed
  • git commands not respecting io redirection
  • Modifying Jenkins Description for a build
  • .tmux.conf: update status commands on panel focus
  • 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.