Git
git add --all |
stage ALL files that have been changed/added/deleted |
git add FILE |
Stage a specific FILE |
git branch -av |
View all of the branches (local and remote) |
git checkout -b BRANCH |
Create a new BRANCH and switch to that BRANCH |
git checkout BRANCH |
Switch to a specific BRANCH |
git checkout FILE |
Revert FILE to most recent commit on local repo |
git commit -m 'MESSAGE' |
Commit changes with short MESSAGE |
git diff --stat --cached origin/BRANCH |
List of files that have been commited (list of files that will be included in next git push) |
git diff FILE |
View changes for a specific FILE; if you just use git diff all changes for all files will be shown. If you have a lot of changes it will end with an (END) on the screen, to quit this screen press the Q key |
git fetch --prune origin |
Fetch branches from origin and prune branches |
git fetch origin BRANCH |
See if there are any changes/updates from a specific BRANCH; could do this prior to git pull |
git log -NUMB |
View a list of the most recent NUMB commits; e.g. git log -2 will show 2 commits |
git pull origin BRANCH |
Pull from specific BRANCH |
git push --set-upstream origin BRANCH |
Push to remote and set upstream |
git push origin BRANCH |
Push to specific BRANCH |
git reset |
Undo git add; will un-stage all files; can also use git reset FILE to unstage specific file |
git status |
see which files have been changed/added/deleted on working branch |
UNIX
In addition to git command, you can use UNIX commands in the bash window/terminal.
cd .. |
Move up one folder; e.g. go from C:/Documents/FOLDER to C:/Documents |
cd FOLDER |
Move down into a specific folder; e.g. go from C:/Documents to C:/Documents/FOLDER |
ls -l |
View files in current folder and their recent mondification |