Git Overview
Version Control/Source Control
Does this look familiar?
Or this?
Tools like Dropbox and Google Drive provide some versioning.
- Previous Versions (Dropbox) or Revision History (Google) are useful in recovering work from a certain point in time.
- Limits on how long versions are available.
- Difficult to view differences.
- Difficult to collaborate as there is a single copy of the document.
Git to the Rescue!
What is a repository?
Think of it as a smart directory that tracks your file history.
What is git?
- Open source software to track changes to your files.
- Distributed version control.
How do we set it up?
$ git init
This command creates a .git directory which you might think of as a database to keep track of the changes you make to your files. This is done automatically when we use "git clone".
$ git clone SOME_REMOTE_URL
This create a directory, adds a .git directory to it, and copies any files from the remote repository.
How do we use it?
The basic Git workflow goes something like this:
- You modify files in your working directory.
- You stage the files, adding snapshots of them to your staging area.
- You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
- You push to a remote repository (for now, think of this as your back up).