Add and commit files

# Check before adding and committing
$ gislt 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> 
$ git commit <files you want to commit> -m “Commit message here”

In the last command, 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 in that last command for whatever reason, you can alternatively do: $ git commit <files you want to commit> This will open vim, a text editor.

Other vim basics:

Yay, you’ve committed your code! Let’s check we added and committed everything we meant to, with $ git status.

Merging master branch into your current branch and resolving merge conflicts