git add) that: are not important / not useful to push to master, are dynamically generated, contain private information (e.g. a secret key), or don’t belong in the repo.# 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.
i to enter “Insert mode” — this will allow you to type text like you would expect.esc key on your keyboard:w to write (save), then :q to quit. Alternatively,:wq and :x are both commands to write and quit at once.j and k to scroll up and down, and h and l for left and right.esc!Yay, you’ve committed your code! Let’s check we added and committed everything we meant to, with $ git status.
master branch into your current branch and resolving merge conflicts