GIT CHEATSHEET

WHAT IS GIT

Git is a versioning control system.

WHAT TO CONTROL

Anything really. I personally use it for this site, personal code projects, backing up things ...

USAGE

To get started you will first need to setup your git account. Then you can clone/push/pull files as need be.

ACCOUNT SETUP

This isn't going to a website necessarily to create and register. This is telling git some basics. Now, on fancier tools such as GitLab or GitHub, you can use your ssh public key for authenticating to your repos. But for less fancy things you will need to setup a email/password combination. Additional options are the editor used for the commit messages, and your diff tool. Some GUI tools can handle reading this in, and modifying them. I use only linux and the terminal for my tasks, so I can't speak for OSX/Windows GUI tools at all, and have only briefly used a few linux ones (GitCola, GitG).

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
git config --global core.editor emacs
git config --global merge.tool vimdiff

Check your settings:

git config --list

CLONE

This will be the first pull done, presuming you have nothing and need to be current with whatever branch you are going to be working with. Some projects are utilizing multiple branches, others just one.

git clone URL_OF_REPO

PULL

As changes are made by those that have modification rights, you will obviously need to grab them. This is a pull.

git pull

PUSH

If you were are someone who is authorized to make changes (commits), have made them, and would like to upload commits to the repo, this is called a push.

git add .
git commit
git push -u REPO BRANCH

Example to a GitLab repo:

git push -u origin master

I MUCKED SOMETHING UP AND CANNOT RE-PULL

Presuming you are using origin/master for your repo & branch

git fetch --all
git reset --hard origin/master

FURTHER READING

https://git-scm.com/book/en/v1/Getting-Started https://help.github.com/articles/set-up-git/