Show Menu
Cheatography

git Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Branch List

List branch tree view
git log --graph
Ex:
git log --graph --pretty=medium --abbrev-commit
List changed files
git ls-tree --name­-only [branc­h-name]
List all branches
git branch
Show branches and their commits
git show-b­ranch

show-b­ranch options

Merge

Mergetool help
git mergetool --tool­-help
Tell git to use opendiff
git mergetool -t opendiff
Merge changes
git merge [merge from branch]

(must be on merge into branch)
 

Commands

Show differ­ences
git diff --name­-only [branch1] [branch2]
Staus of changes
git status
Add change­/file to be committed
git add .
 
git add [file_­name]
Commit changes
git commit -m "Your message here"
Commit changes - Vim editor save
esc - :w ( save ) - :q ( quit )
Create new branch
git checkout -b [New Branch Name]
Remove file from commit - Step 1
git rm my-bad-file.txt
Remove file from commit - Step 2
git commit --amend

if a commit was performed
Ignore files
create .gitignore file - add file names to ignore
Remove from add
git reset [filen­ame.txt]
 

Links

--pretty
reset