git add, commit and push commands in one?

前端 未结 30 1413
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 03:15

Is there any way to use these three commands in one?

git add .
git commit -a -m \"commit\" (do not need commit message either)
git push

Som

30条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 04:07

    I think you might misunderstand the workflow that git was designed for. (To clarify/correct what I meant in the comment, you don't need the git add ., since commit -a usually serves the same purpose - adding any changes that have not yet been staged, if the files have already been added)

    Typically you'll do something like this:

    # make some changes
    $ git commit -a -m "Changed something"
    # make some more changes
    $ git commit -a -m "Changed something else"
    

    wash, rinse, repeat, until you've finished feature X, or you're at a stopping point, or you just want other people to see what you've done. Then you do

    $ git push
    

    Git is not SVN - but it appears that you're trying to use it as such. You might find some of the resources at the end of the article here to be of some use.

提交回复
热议问题