1

I want to combine the git push command to one line, such as gitpush -m "fix bug #123" -f file1.html, file2.html ...

only file1.html and file2.html will commit and update to the server

how to make it?

1 Answer 1

1

try adding the following function to your .bashrc (or .bash_profile if Mac):

function allinone() {

    for i in ${@:2}
    do
        git add $i
    done

    git commit -a -m "$1"
    git push

}

Then you just can add, commit and push typing:

allinone "Adding, commiting and pushing 3 files at once" file1.html file2.html file3.html

The first parameter must be the comment, and the rest of the parameters are the files that you want to add, commit and push (notice that files are separated by spaces)

I hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.