Version Control Systems
Version Control Systems
1
Why version control?
For working by yourself:
Gives you a “time machine” for going back to earlier versions
Gives you great support for different versions (standalone,
web app, etc.) of the same basic project
For working with others:
Greatly simplifies concurrent work, merging changes
For getting an internship or job:
Any company with a clue uses some kind of version control
Companies without a clue are bad places to work
2
Why Git?
Git has many advantages over earlier systems such as
CVS and Subversion
More efficient, better workflow, etc.
See the literature for an extensive list of reasons
Of course, there are always those who disagree
Best competitor: Mercurial
I like Mercurial better
Same concepts, slightly simpler to use
In my (very limited) experience, the Eclipse plugin is easier to
install and use
Much less popular than Git
3
Download and install Git
There are online materials that are better than any that I could
provide
Here’s the standard one:
http://git-scm.com/downloads
Here’s one from StackExchange:
http://stackoverflow.com/questions/315911/git-for-beginners-the-
definitive-practical-guide#323764
4
Introduce yourself to Git
Enter these lines (with appropriate changes):
git config --global user.name "John Smith"
git config --global user.email [email protected]
You only need to do this once
5
Create and fill a repository
1. cd to the project directory you want to use
2. Type in git init
This creates the repository (a directory named .git)
You seldom (if ever) need to look inside this directory
3. Type in git add .
The period at the end is part of this command!
Period means “this directory”
This adds all your current files to the repository
4. Type in git commit –m "Initial commit"
You can use a different commit message, if you like