git commit -m vs. git commit -am

后端 未结 2 674
不思量自难忘°
不思量自难忘° 2021-01-30 01:43

Seems easy but I just don\'t get it. I am in the root of my application.

Here is my workflow.

git add .
git commit -m \"added a new feature some files ch         


        
相关标签:
2条回答
  • 2021-01-30 01:54

    From the docs:

    git commit -a automatically stage all tracked, modified files before the commit If you think the git add stage of the workflow is too cumbersome, Git allows you to skip that part with the -a option. This basically tells Git to run git add on any file that is "tracked" - that is, any file that was in your last commit and has been modified. This allows you to do a more Subversion style workflow if you want, simply editing files and then running git commit -a when you want to snapshot everything that has been changed. You still need to run git add to start tracking new files, though, just like Subversion.

    Using the option -am allows you to add and create a message for the commit in one command.

    0 讨论(0)
  • 2021-01-30 01:57

    I would suggest, if you only changed one file then you might do something like this:

    git add "Your_file.txt"
    git commit -m "added a new feature in a file"
    git push heroku master
    

    Or if you changed multiple files then you could do something like this:

    git add .
    git commit -m "some files changed"
    git push heroku master
    

    Similarly, you could add and commit all the files on one line with this command:

    git commit -am "added a new feature some files changed"
    git push heroku master
    
    0 讨论(0)
提交回复
热议问题