3.3 Git on your own

Diagram of Git commands and how they relate to one another.

Figure 3.1: Diagram of Git commands and how they relate to one another.

  • git init: turn the current folder into a git repository
  • git status: let’s you know what is going on run this all the time!
  • git add: put file(s) into your “staging area”
  • git commit -m 'MY COMMIT MESSAGE': commits files in the “staging area” with the given message
  • git diff <file name>: compares saved changes to a file to the last commited version of the file
  • git diff --staged <file name>: compares a staged file to the last commited version of the file

  • git log and git log --oneline: looks at your git history
  • git log --oneline --graph --decorate --all: gives detailed log information about where you are

How not to write commit messages: