Authors: @Jacqueline Osborn, @Kendall Hester, @Kelley Chau, @Yousef Ahmed

Add files

Adding files lets you put the files and their changes (including things like deleting or adding a file) in a commit and eventually those changes get pushed to main.

# Check before adding and committing
$ git branch  # make sure you’re on the right branch
$ git status  # view which files were changed
$ git diff  # view the changes

# Add and commit your code
$ git add <changed files you want to add> 

Commit files

Commits are little code checkpoints- when you push, you'll be able to look through your code at each commit and revert back to one if needed.

$ git commit <files you want to commit> -m “Commit message here”

In git commit -m, the -m flag allows for an in-line message that directly follows. This is really convenient and much faster!

If you don’t want to use the -m flag, you can alternatively do: $ git commit <files you want to commit> This will open a text editor (maybe vim).

Vim Tips