Git Guide for Good

What can we do with Git?

Setup

git init
git clone /path/to/repository

Add & Commit

git add <file-name>
git add .
git add .
git reset <file-name>
git rm <file-name>
git commit -m “Meaningful commit message”

Push

git push origin <branch-name>
git remote add origin <server>

Branch

git checkout -b <branch-name>
git checkout <branch-name>
git branch -d <branch-name>
git branch

Update & Merge

git pull
git pull <remote> <branch>
git merge <branch>

History

git log

Stash & Revert

git stash
git revert HEAD

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store