How To Commit with Git

To commit your work is probably the thing you do the most with git. It’s basically to save a snapshot of your current project, making it possible to go back to that specific snapshot of your code.


Add file

You can either add single files or all files that have been modified at the same time.

# Single files
git add <filename1> <filename2>

# All files
git add .

Commit message

You always have to specify a short message for each commit.

git commit -m "This is the commit message"