As soon as people start their programming careers, they are hit with the ton of bricks that is the version control system (VCS).
Version control software is used to keep track of, manage, and secure changes to files. This is a very important part of modern software development projects.
SVN (Subversion)
Git (git)
Add
Commit
Revert
Remove
Branch
Merge
IDEs have plug-ins for dealing with version control systems and usually have built-in support for popular systems such as SVN and Git.
Subversion
SVN1 was made as an improvement to an ancient and very popular VCS called CVS. It was a huge leap forward. Among other benefits, it allows any directory in the hierarchy to be checked out of the system and used. SVN requires a server to store the history, tags, and branches of the code. Programmers then use the SVN client to commit code changes.
Git
Git2 is a distributed version control system. This means that every copy of the source code contains the entire history of the code. However, unlike most other systems, it stores the history in a very compact and efficient and secure way—each commit is associated with a hash (a compact, but unique value generated from larger values by a one-way algorithm). It was initially created by the creator of Linux (Linus Torvalds) and is very popular.
Install Git. Go to github.com3 and clone a repository, for example, git clone https://github.com/adamldavis/learning-groovy.git. Now create your own GitHub account, create a new repository, clone it, and follow the preceding instructions to add a new file to it. Lastly, use git push to push the changes to GitHub.
When you have a remote host set up in your local git repository (like when you cloned a repository from GitHub), you are able to push changes to it and pull changes from it. For example, the git push command pushes your commits to the remote host, and the git pull command gets changes from the host (that other developers might have put there).
git log: Shows all commits, most recent first
git status: Shows the current status of your git repository
git show: Given a commit hash, shows all changes of that commit
git checkout: Given a branch name, loads that branch
git merge: Joins two or more development histories together
git branch: Can be used to list, create, or delete branches
git tag: Can be used to list, create, or delete tags
git help: Gives you helpful documentation. Gives help specific command when used like git help <command>
Mercurial
Mercurial4 predates Git but is very similar to it. It’s used for a lot of projects on Google Code and Bitbucket.5
Install Mercurial. Go to Bitbucket and clone a repository using Mercurial, for example, hg clone https://bitbucket.org/adamldavis/dollar.