Git vs. CVS Advantages
In Git your working copy is a clone of the entire repository. This includes branches and tags. This decreases the overhead (speed and manual work) involved when switching contexts and the need to be connected to a network. Some examples are:
- When switching branches there is no need to connect to a remote server or close your IDE/project and open a checkout in another directory. Running
git checkout [branch name]is all you need to do.
- When merging you do not need a connection to the remote server, you have all branches locally. Since branches are so cheap in Git you could create a new branch to perform the merge in so that if you had a large amount of conflicts you could incrementally work on and commit without affecting the main branch then merge or create a patch after everything has been fixed.
- Because Git is a distributed system in addition to connecting to a central repository developers can connect to another developers repository. This allows teams to share code without affecting the central repository.
Many of Git's features are designed around improving or being able to deal with the development workflow. Some interesting features are:
git stash-- Can be used when you are in the middle of coding something and are not at a point you feel comfortable committing then interrupted to work on something with immediate priority. This will create a special type of tag (without commit) that has to be unstashed and will not get pushed or pulled.
git checkout -b [new branch] [source branch]-- Branching is central enough in Git that it's checkout command allows you to create a new branch during the checkout process.
In most systems tracking is done on files and versioned at either the file or commit. Git however tracks content (which is what is really important anyways). Because of this Git is capable of tracking things like a method being moved from one class to another class and being able to include the history prior to the move.