VCS Command Guide
I use Mercurial and Git for various different projects. There is a lot of discussion on the web about which is best; however, in my experience they're both good in different ways and I use different VCSs for different projects as appropriate. However, since they work in different ways and with slightly different commands, I often find it hard to remember the right command. Therefore, I thought I'd make this page, which contains a simple reference for how to do things in each version control system. There may well be errors (especially in the git commands as I use this least often at the moment).
If you notice anything wrong or can fill in any of the gaps, please drop me a note using this form.
Required Reading![](/templates/common/img/slidedownarrow.png)
Mercurial | Git |
---|---|
HG Init is a good tutorial, but mercurial is pretty easy (and safe) to use. | How to use git to lose data should be required reading for any git user - I've lost data that I really didn't want to lose when using git, so since then I've always been a bit nervous. |
Start New Project with a copy on a server![](/templates/common/img/slidedownarrow.png)
Get a project from elsewhere![](/templates/common/img/slidedownarrow.png)
Add all files![](/templates/common/img/slidedownarrow.png)
Look for deleted files![](/templates/common/img/slidedownarrow.png)
Show differences in working tree![](/templates/common/img/slidedownarrow.png)
Show history![](/templates/common/img/slidedownarrow.png)
Show differences introduced in the latest revision![](/templates/common/img/slidedownarrow.png)
Commit all changes![](/templates/common/img/slidedownarrow.png)
Commit specific files with message![](/templates/common/img/slidedownarrow.png)
Commit specific changes within File![](/templates/common/img/slidedownarrow.png)
Get the latest changes into working dir![](/templates/common/img/slidedownarrow.png)
Push latest changes![](/templates/common/img/slidedownarrow.png)
Create a new branch![](/templates/common/img/slidedownarrow.png)
Switch back to the main branch![](/templates/common/img/slidedownarrow.png)
List available branches![](/templates/common/img/slidedownarrow.png)
Merge changes from another branch![](/templates/common/img/slidedownarrow.png)
Show last entries in log![](/templates/common/img/slidedownarrow.png)
![](/templates/common/img/slidedownarrow.png)
Ignore files with a glob syntax![](/templates/common/img/slidedownarrow.png)
Revert changes in working tree![](/templates/common/img/slidedownarrow.png)
Undo commit![](/templates/common/img/slidedownarrow.png)
Get information about working tree![](/templates/common/img/slidedownarrow.png)
Show files that have changed![](/templates/common/img/slidedownarrow.png)
Get revision information![](/templates/common/img/slidedownarrow.png)
Add an empty directory (if required by toolchain)![](/templates/common/img/slidedownarrow.png)
Add a new tag to the current revision![](/templates/common/img/slidedownarrow.png)
Add a tag to a previous revision![](/templates/common/img/slidedownarrow.png)
List all tags![](/templates/common/img/slidedownarrow.png)
Get rid of ignored files![](/templates/common/img/slidedownarrow.png)
Find tagged commits with a given file in the repository![](/templates/common/img/slidedownarrow.png)
Find commits that modify a given file in the repository![](/templates/common/img/slidedownarrow.png)
This website is free, but costs me money to run. If you'd like to support this site, please consider making a small donation or sending me a message to let me know what you liked or found useful.