Skip to content

Instantly share code, notes, and snippets.

@chrisvasey
Last active June 16, 2020 10:43
Show Gist options
  • Save chrisvasey/f3ffbbbc733eca9eb69aa5e23d7814d4 to your computer and use it in GitHub Desktop.
Save chrisvasey/f3ffbbbc733eca9eb69aa5e23d7814d4 to your computer and use it in GitHub Desktop.
A short cheat sheet for saving your arse with version control.

How to git

A short cheat sheet for saving your arse with version control.

First run

Create the repo git init

Track everything

git add -A

Commit stuff

git commit -m "initial commit"

Adding a remote origin to push to

git remote add origin "github url"

Seeing any existing remotes

git remote -v

Push commits up to GitHub

git push origin master

Pull chnages from GitHub

git pull origin master

Reset repo back to last commit

git reset --hard

Seeing list of past commits

git log

See any changes since last commit

git status

Clone a new copy

git clone "repo url"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment