Git

From Schmid.wiki
Jump to: navigation, search

Git Cheat Sheet

Basic usage:

git add -A                    # stage all: new files, modified files, and deletions
git checkout /path/to/file    # revert file changes

Inspect stage area:

git reset --hard HEAD         # erase all local changes
git reset HEAD /path/to/file  # undo staging of file
git diff --cached             # inspect staged changes
git diff --cached --name-only # inspect staged changes, filenames only

Push and pull:

git push -all                 # push all branches to origin

Branches:

git branch               # list all branches
git branch branch_name   # create branch
git checkout branch_name # switch to branch

Resolving conflicts: Remove conflicts by editing conflicted files, then:

git add conflicted_file
git commit

Tools

* GitExtensions for Windows
Personal tools