Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.

Git Daily Use

Tags: git

The locations:

Working Directory <---> Staging <---> Local Repo <---> Remote Repo

The most important verbs, in order of importance:

  • git clone
    • Bring down the remote repo to your local repo for the first time.
  • git pull
    • Bring down new changes from the remote repo to your local repo.
  • git status
    • Check the status of your stuff.
  • git add
    • Move content to staging.
  • git commit
    • Move content from staging to your local repo.
    • git commit -m "Some message."
  • git push
    • Move content from your local repo to the remote repo.
  • git log
    • Show the history of your commits.
    • git log --oneline
    • git log -5

Other useful command you will eventually want to learn.

  • git reset
    • git reset --hard
    • git reset --soft
  • git checkout
  • git branch
  • git merge
  • git rebase
  • git diff

Recommended reading:

https://git-scm.com/book/en/v2

  • Chapter 2 - for daily use
  • Chapter 3 - for slightly more advanced stuff
  • Chapter 10 - for going deep
  • Chapter A3 - as a reference