Robotics‎ > ‎

DVCS (Git)

DVCS stands for distributed version control system. It's a tool that many programmers use to track changes in their programs. Several DVCSs exist, the most popular being Git. When used in conjunction with an online service like GitHub or Bitbucket, it also allows programmers to collaborate on the same files at the same time as well as backup their program's file online.

Installation on Windows
Git for Windows can be downloaded from If you plan to use the same computer each time you work on your program, download and install the version that begins with Git. If you will be using multiple computers, you should download the portable version and extract it to a your USB flash drive (the same one you store your programs on).

BeagleBone Black
Most images for the BeagleBone Black come with Git pre-installed.

Setting up Git
config --global "John Doe"
config --global
config --list (list all settings - make sure they are correct)

Setting up a Repository
init (initialized a repository)
remote add [short name] url
remote (see a list of current remotes)

Commiting & Pushing
add myfile
add -u (stage all changed files)
commit -m "Add a note about the commit here" (creates a snapshot of the project on the local machine)
push [short name] [branch]
pull [short name] [branch] (retrieve latest commits made online or by others)

tag (list tags)
tag [name of tag]
tag -a [name of tag] -m "Comment about tag"
push [short name] --tags

Other Useful Commands
gitk (GUI to visualize history)
fetch [short name] (fetch branches and/or tags from one or more repositories)
branch [branch name] (create a new branch)
checkout [branch name] (switch to branch)
reset --hard HEAD~1 (completely delete last commit)
push -f (use this following the above command to remove the last commit from the online repository too if it's already been pushed)

In the event your computer dies and you need to recover your code from your online repository, you can do so using the following procedure:
  1. mkdir [directory name]
  2. cd [directory name]
  3. git init
  4. git remote add [short name] url
  5. git fetch [short name]
  6. git checkout [branch]