A distrubuted version control system
A program we run via the command-line...
Or with a user-interface.
It manages the source code for your project
It talks to remote repositories
Save progress
Safely experiment
Go back to an earlier state
Make changes to the same project
Get feedback
Contribute to work belonging to other people
git init, git status, git add, git commit
$ git init
Everything happens inside a repository
repo = folder
Once you turn on git, it is ALWAYS WATCHING
git status shows you what git can see
git init initialises your git repository
i.e. tells git to track what you do inside that folder
such as creating new files
making changes to files
deleting files
etc.
beware gitception
Git is always watching...
But you need to tell it to remember what you've done
Omniscient Elephant
A commit is a snapshot of changes
AKA the commands you type and in which order
$git add .
$git commit -m "Initial commit"
When to commit?
$git tag
$git log
Break everything
Put it back to how it looked before you ruined it
Rewrite history
Share your work with the world
Or back it up for yourself
git push whereto whichbranch
$ git push origin master
Get the latest changes
$git init
$git add "README.txt"
$git commit -m "Initial commit"
(Create GitHub repo)
$git remote add origin [url]
$git push origin master
$git clone [url]
$git pull
*do work*
(lots of git add, git commit)
$git push
$git merge
Gotcha: .gitignore
$ git branch NAMEOFBRANCH
$ git checkout NAMEOFBRANCH
$ git checkout -b NEWBRANCH
$ git checkout master
$ git merge NEWBRANCH
Before you do work:
git init OR git clone OR git pull
Do work
After you do work:
git add "this.txt", git commit -m "Add this"
You did good work, show somebody:
git push origin mybranch