Cheatography
https://cheatography.com
Create
git clone |
Clone an existing repository |
git init |
Clone a local repository |
git add |
Add files to staging |
git commit |
Commit staged changes to the repository |
git commit --amend |
Reword the last commit message |
git mv |
Move or rename a file |
git rm |
Unstage files |
Branches
git branch |
Lists all branches |
git checkout <branch> |
Switches to a new branch |
git checkout -b <branch> |
Creates the new branch while also switching to it |
git branch -d <branch> |
Deletes the branch |
git merge <branch> |
Merges current branch into <branch> |
Update
git remote -v |
List remotes |
git remote add <path> |
Adds a new remote |
git fetch |
Get the latest changes from origin |
git pull |
Get the latest changes and merge |
git push |
Publish local changes to the repository |
git push <remote> :<branch> |
Deletes remote branch |
git reset --hard HEAD |
Undo local commits |
|
|
git rebase and cherry pick
git rebase <branch> |
Takes the current branch's commits and applies them on top of another base |
git rebase -i |
Changing commits in ways such as editing, deleting or squashing |
git rebase --continue |
Staging files changes during interactive rebase |
git rebase --abort |
Terminates the process |
git cherry-pick <commit> |
Choose commits from one branch and apply it onto another |
git bisect
git bisect start |
Begins the bisect process |
git bisect good/bad <tag> |
Marks <tag> as a broken or working version |
git bisect good/bad |
Marks the commit as good or bad |
git bisect reset |
Ends the bisect process |
git log
git reflog |
Displays an ordered list of the commits that HEAD has pointed to |
git log--<limit> |
Limit the number of commits displayed |
git log --oneline |
Limit each commit to a single line |
git log --stat |
Shows the file(s) that have been modified, the number of lines that have been added or removed and also displays a summary line |
git log --grep="<pattern>" |
Search for a specific word/phrase in a list of commits |
git log --author="<author>" |
Display all commits by an author |
git log -- <file> |
Only show commits in a certain file |
git log --merges |
Display a log with only merge commits |
git shortlog |
Group commits by their authors |
git diff |
View the difference between two commits |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets