larry-fuy
10/31/2014 - 6:11 PM

Git overview

Git overview

Git workflow

Start a new project

  • git init
  • git clone

Update a project

  • git status
  • git fetch (update without merge)
  • git pull (update and merge)
  • git commit

List branches

  • git branch (local branch)
  • git branch -r (remote branch)
  • git branch -a (all branches)

Create a branch

  • git branch [branch name] (remote branch)
  • git checkout -b [branch name] (only generate local branch)
  • git push -u [remote name] [branch name] (push local branch to a remote-tracking branch)

Delete a branch

  • git branch -d [branch name] (remove local branch)
  • git push [remote] --delete [branch name] (remove remote branch)

Switch between branches

  • git checkout [branch name]

Merge the branch

  • git merge [branch name] (merge [branch name] to the current branch)

Store temporary changes

  • git stash save "message" (create a stash)
  • git stash list

Three way merge

Git Resources