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.

Local

git status
Display changed files and current branch
git diff
Display changes
git add <fi­len­ame­1> <fi­len­ame­2> <fi­len­ame­3>
Track and stage new files for commit <fi­len­ame>
git add .
Track and stage new files for commit all files in this directory
git add -u
Stage all tracked files for commit
git commit -m "Change log/me­ssage"
Locally commit changes
git reset --hard
Reset code to last commit, undo all changes
git push origin <branch name>
Push commits to git branch
Many more git commands exist but this list is all you should need. If you need to perform a different task or need help in git, ask me for assist­ance. Any other commands could be dangerous and potent­ially cause unnece­ssary headache to revert.

Example

git add -u
Stage all changed files for commit
git commit -m "I made this change in the code""
An inform­ative message that explains what was changed
git push origin <branch name>
Push commits to git branch
Make sure to use you are pushing to the correct branch so you are not changing someone else code. If you are unsure, you can use git status or access the web interface to make sure you are working in and committing to your specific branch.