Clone a repository
Cloning refers to making a copy of a repository (e.g. https://github.com/bbc/vjdata.24555.cqcfsa) to your local machine - so you can have access to the code on your own pc.
git clone git@github.com:bbc/vjdata.24555.cqcfsa.git
Initiate a repository from scratch
Requires an existing folder whose changes you want to track (called the 'working directory')
This command will create a .git folder inside the directory, which is responsible tracking the changes your are making.
cd
into the directorygit init
Check what files have been modified locally
git status
Create a branch to work on a new feature
git checkout -b <your-branch-name>
Add a single file to the stage
git add <filename>
Add all files to a the stage
git add .
Commit staged files
git commit -m <your-commit-message-goes-here>
Push the local branch you created to Github
git push origin <your-branch-name>
Push changes after remote branch has been created
git push
Merge a branch into your branch
git merge <branch name
Get latest details about branches
git fetch origin
I've made a mistake, and I want to overrite my local work with what's on master
git fetch origin
git reset --hard origin/master
Resource: https://education.github.com/git-cheat-sheet-education.pdf