Simon's Git(Hub) Reference

Git and GitHub Commands that I use repeatedly. Despite this, I fail to remember them, so here they are for when I forget.


Tools: Git Tags: Console Git Github

Create a new repo from existing files

Assuming you’ve already set up your ssh stuff

git init
git add .
git commit -m "first commit"
git remote add origin
git push -u origin master

Creating and pushing to a gh-pages branch

git branch gh-pages
git push -u origin gh-pages

Go to and change gh-pages to master branch

Force pull

git fetch --all

Then, you have two options:

git reset --hard origin/master

OR If you are on some other branch:

git reset --hard origin/<branch_name>


Force Push

Push local stuff and ovwerwrite remote

git push origin <your_branch_name> --force

for example for force pushing to gh-pages branch

git push origin gh-pages --force


You can find me on Twitter, Youtube and GitHub.