Git Add, Commit and Push in one command line.

How to push code in just one command line?

$ git add .
$ git commit -a -m "commit" (do not need commit message either)
$ git push
According to btse's answer in Stackoverflow, we can add following function to .bashrc in Linux or .bash_profile in Mac. If you don't have .bash_profile, just create a new one, and put the code snippet in the file.
function lazygit() {
    git add .
    git commit -a -m "$1"
    git push
}
Now we can simply push code in a single command line:
$ lazygit "My commit msg"

Reference:

Share:

0 意見:

張貼留言