Newbie Git Cheatsheet
Here are a couple of git commands for you new gits 😉
Create new branch
git branch NewBranchName
Checkout to newly created branch
git checkout NewBranchName
Create new branch AND checkout to it
git checkout -b NewBranchName
Add single file
git add fileName.txt
Add multiple files individually
git add fileName1.txt fileName2.php
Add all files
git add .
First initial commit
git commit -m "We have just commited something"
Amending the initial commit
git commit --amend
Amending the initial commit with a new message
git commit --amend -m "We have amended our last commit"
Stashing your work
Un-stashing your work
git stash pop
Word of warning: Stashing is not local to your branch, but global to your project, so be careful!
Unmodifying a modified file
git checkout -- fileName.txt
Word of warning: you can’t reverse this command, so double check the files before you discard your changes!