How to commit a change with Git in the terminal

Girl with smoke bomb

Step 1: Navigate to File in Terminal

Open the terminal, or command line, and navigate to the folder of the file you wish to commit the changes of. You can do this in the Windows Command Prompt by using cd "C:\path\to\file"

Step 2: git add

Use git add to add one or several files to the git staging area. These files are recorded in the staging area, and in the next step their changes will be committed.

Step 3: Check Status (Optional)

Use git status to check which files are staged for changes. You should see a message such as that below:

Git status in VScode

Step 4: git commit -m "Type your message here"

Use the command git commit -m "Type your message here" to commit the changes. You should get a success message with something like “1 file changed…”. See below:

Git commit -m.

Step 5: Pat yourself on the back.

Congratulations! You’re done.

Cliffs and sunset.

Smoke bomb girl by Tyler Kaslik on Unsplash

Cliffs by by v2osk on Unsplash