Git Cheat Sheet


git cheat sheet
Tower – the most powerful Git client for Mac
presented by
BranChes & tags
merge & reBase
List all existing branches
Merge <branch> into your current HEAD
Clone an existing repository
$ git clone
$ git branch
$ git merge <branch>
Create a new local repository
Switch HEAD branch
Rebase your current HEAD onto <branch>
Don‘t rebase published commits!
$ git init
$ git checkout <branch>
$ git rebase <branch>
Create a new branch based on your
current HEAD
Abort a rebase
loCal Changes
$ git branch <new-branch>
$ git rebase --abort
Changed files in your working directory
Create a new tracking branch based on
$ git status
Continue a rebase after resolving conflicts
a remote branch
$ git rebase --continue
Changes to tracked files
$ git branch --track <new-branch>
$ git diff
Use your configured merge tool to
solve conflicts
Add all current changes to the next
Delete a local branch
$ git mergetool
$ git branch -d <branch>
$ git add .
Use your editor to manually solve con-
Mark the current commit with a tag
flicts and (after resolving) mark file as
Add some changes in <file> to the next
$ git tag <tag-name>
$ git add <resolved-file>
$ git add -p <file>
$ git rm <resolved-file>
Update & pUBlish
Commit all local changes in tracked files
List all currently configured remotes
$ git commit -a
$ git remote -v
Commit previously staged changes
Discard all local changes in your working
Show information about a remote
$ git commit
$ git remote show <remote>
$ git reset --hard HEAD
Change the last commit
Add new remote repository, named
Discard local changes in a specific file
Don‘t amend published commits!
$ git checkout HEAD <file>
$ git commit --amend
$ git remote add <remote> <url>
Revert a commit (by producing a new
Download all changes from <remote>,
commit with contrary changes)
but don‘t integrate into HEAD
$ git revert <commit>
Commit history
$ git fetch <remote>
Show all commits, starting with newest
Reset your HEAD pointer to a previous
Download changes and directly merge/
$ git log
integrate into HEAD
…and discard all changes since then
Show changes over time for a specific file
$ git pull <remote> <branch>
$ git reset --hard <commit>
$ git log -p <file>
Publish local changes on a remote
…and preserve all changes as unstaged
Who changed what and when in <file>
$ git push <remote> <branch>
$ git blame <file>
$ git reset <commit>
Delete a branch on the remote
$ git push <remote> :<branch>
…and preserve uncommitted local
Publish your tags
$ git reset --keep <commit>
$ git push --tags
30-day free trial available at
the most powerful Git client for Mac


00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Page of 2