Question

Assuming that <filename> is being tracked by git, is git commit -m "message" <filename> possible without doing a git add <filename>?

Was it helpful?

Solution

Yes. If you issue:

git commit -m "message" /file/to/save.c

save.c will be added and committed alone, provided that it is already tracked by Git.

You can find it mentioned in the Git commit manual page (point 3 of the first list).

OTHER TIPS

To avoid having to explicitly add each file you modify, you could use git commit -a -m "message": it will automatically add each tracked file and commit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top