ACM@UIUC TIL logo ACM@UIUC TIL

Staging

To add a set of changes to a project using git you must commit them and in order to commit them you must stage them. There are gour common staging commands:

git add .

stages new and modified, without deleted

git add -A

stages All

git add -u

stages modified and deleted, without new

git add --interactive

pick specific files to commit via CLI

You can also just pass paths to files / directories as arguments to git add to stage them

To see what is staged you can run:

git status 

And if you want to unstage everything run:

git reset 

Commiting

To commit typically people use:

git commit -m "COMMIT MESSAGE"

A Faster Way

It is a common practice to just stage all tracked files and commit them. So you can combine the commit and staging steps with

git commit -am "commit message"

or

git commit -m --interactive "commit message"

if you want to stage certain files