Skip to content

Instantly share code, notes, and snippets.

@larry-fuy
Last active September 11, 2015 02:16
Show Gist options
  • Save larry-fuy/64509cd0b6fc3ff44690 to your computer and use it in GitHub Desktop.
Save larry-fuy/64509cd0b6fc3ff44690 to your computer and use it in GitHub Desktop.
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

Git Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment