What would be the difference between typing: git commit -m "Teste"
and git commit -am "Teste"
?
I'm learning about Git and would like to know how to differentiate it.
What would be the difference between typing: git commit -m "Teste"
and git commit -am "Teste"
?
I'm learning about Git and would like to know how to differentiate it.
The command:
git commit -m "Teste"
Commits only the modified files that are added in the stage area ( Changes to be committed
) of Git. That is, it's just the files you've added using a command like this:
git add nome_arquivo.txt
Or this:
git add .
Already the command:
git commit -am "Teste"
It does two things: it adds all the modified files in the stage area and then commits them. In terms of command, it's the same as you did these two commands below:
git add . # adiciona todos os arquivos modificados no stage
git commit -m "Teste" # faz o commit dos arquivos modificados
Instead of having to make a git add <meu arquivo>
(which adds the file to commit) and then make a git commit -m <minha mensagem de commit>
(which commits its change by assigning a message to it), git commit -am <minha mensagem de commit>
already does these two steps at a time.
The git commit -m
defines only the commit of changes that have been previously added to your tree, combining this option with -m
, which expects a message to bring your commit to life.
By using -a
, in addition to the commit and message, add all files that