Dec
02

My Git learning notes

Git Basic

  • Git Help
    • $ git help
    • $ git help config
  • Setting up git
    • $ git config –global user.name “xxx”
    • $ git config –global user.email “xxx@xxx.com”
    • $ git config –global color.ui true
  • Starting a Repo
    • $ git init
    • Work flow:
      • create file aaa.txt
      • add aaa.txt to staging area
      • commit changes
      • modify aaa.txt
      • add aaa.txt to staging area
      • commit changes
    • $ git status : watch the status
    • $ git add aaa.txt : add the modified file into staging area
    • $ git commit -m “hahaha!”
    • $ git add aaa.txt bbb.txt : add two files to staging area
      $ git add –all
      $ git add *.txt : add all txt files in current directory
      $ git add docs/*.txt
      $ git add docs/
      $ git add “*.txt” : add all txt files in the whole project
    • $git commit -m “hahahaha!”
  • Timeline History
    • $ git log