|
Set a user name
|
git config --global user.name "[firstname last name]"
|
|
Set an email
|
git config --global user.email "[valid email]"
|
|
Set automatic command line coloring
|
git config --global color.ui auto
|
|
Initialize a directory
|
git init
|
|
Clone an entire repository via URL
|
git clone [url]
|
|
Show the commits in B but no in A
|
git log branchB..branchA
|
|
Show the commits that changed file
|
git log --follow[file]
|
|
Show the diff of in A but no in B
|
git diff branchB...branchA
|
|
Show any object in git
|
git show [SHA]
|
|
Delete the path from project and stage the removal for commit
|
git rm [file]
|
|
Change an existing file path and stage the move
|
git mv [existing-path] [new-path]
|
|
Show all commits logs with movements in path
|
git log --stat -M
|
|
Save a file with desired patterns as .gitignore
|
*.notes/
|
|
Configure the file
|
git config --global core.excludesfile [file]
|
|
Show modified files in working directory
|
git status
|
|
Add a file to stage
|
git add [file]
|
|
Unstage a file
|
git reset [file]
|
|
Diff of what is changed but not staged
|
git diff
|
|
Diff of what is staged but not committed
|
git diff --staged
|
|
Commit your staged content
|
git commit -m "[descriptive message]"
|
|
List your branches
|
git branch
|
|
Create a new branch
|
git branch [branch-name]
|
|
Switch to another branch
|
git checkout
|
|
Merge the branch into the current
|
git merge [branch]
|
|
Show all the commits
|
git log
|
|
Add a git URL as an alias
|
git remote add [alias] [url]
|
|
Fetch down all the branches from git remote
|
git fetch [alias]
|
|
Merge remote branch into your current branch
|
git merge [alias]/[branch]
|
|
Transmit local branch commits to remote
|
git push [alias][branch]
|
|
Fetch and merge all commits
|
git pull
|
|
Apply any commits of current branch ahead of specified one
|
git rebase [branch]
|
|
Clear staging area and rewrite working tree fro specified commit
|
git reset --hard [commit]
|
|
Save modified and staged changes
|
git stash
|
|
List stack-order of stashed file changes
|
git stash list
|
|
Write working from top of stash stack
|
git stash pop
|
|
Discard the changes from top of the stack
|
git stash drop
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.