From PaparazziUAV
Revision as of 11:00, 6 April 2011 by Flixr (talk | contribs) (Line endings)

Jump to: navigation, search

How to use git with the papaprazzi master repo.

Git help and resources

There are tons of tutorials, etc. out there... You can also get help on any Git command by doing git command -h or git help command.

For a quick introduction see the Git crash course for SVN users. For git newbies the Git CheatSheet is also nice.

To get an understanding off the git internals the video Getting Git is excellent.


Before You Start

Git is not an evolution of SVN (like SVN is from CVS). This may lead to a lot of extra headscratching among migraters. You have been warned.

Basic Git configuration

First tell git your real name and your e-mail address. You should add these before you start using Git:

git config --global "Your Name"
git config --global

Set up a Github account

If you want some github awesomeness you have to set up an account there and set your github token. Just go to the webpage and create an account there. Do not forget to upload your ssh key there. Here is a good tutorial on providing your ssh key to GitHub. Otherwise you will not be able to access your repositories.

Get the code

If you plan to contribute or just to push your own config to github please first fork the papaprazzi repo on github. Just log in and click fork at the top of the main paparazzi software repository.

Option 1: clone from your own github repo

If you already forked the paparazzi-software repo to your own github account:

git clone -o <username><your github username>/paparazzi.git

The option -o <name> uses name to keep track of the upstream repository instead of using the remote name origin. It is recommended to call the remote for the papaprazzi master repo paparazzi and name your own github remote according to your name to avoid confusion.

Adding remotes

Now you want to add the main repo as a remote with the name paparazzi to easily pull changes from there:

cd paparazzi
git remote add paparazzi git://

The above URL provides read-only access, if you are a dev and have write access to the main repo as well you want to use:

git remote add paparazzi

Option 2: clone from github without an account

Otherwise clone directly from the master repo (read-only):

git clone git://

or if you are behind a firewall with an http proxy available:

git clone

Get to work

To show the status (modified and staged changes) you can run

git status

Gitk is your friend if you want to visualize all remotes/branches and history:

gitk --all

Pull and push

Have a look at the very good short overview of pushing and pulling on

To fetch the changes from the paparazzi master branch on github and merge them into your local branch run

git pull <remote> master

Where <remote> is the name for the remote to the main paparazzi repo and is usually paparazzi or origin.

To push your (already locally committed) changes to your own github master branch

git push <remote> master

Where <remote> is the name for the remote to your own github repo and is <username> if you named it like explained above.


It is advisable to do all your work in a branch an then merge back into master when it is ready. Please send us a pull request on github.

Advanced Configuration and helpful tools

If you want to inspect your global configuration, have a look at the .gitconfig file in your home directory.

The per repository configuration is stored in the .git/config file in your repository.

Colors and Aliases

You also might want to set some color options and aliases, e.g.:

git config --global color.ui auto     # colors for all
git config --global status   # make `git st` work
git config --global checkout # make `git co` work
git config --global commit   # make `git ci` work
git config --global branch   # make `git br` work
git config --global alias.up "pull --rebase"   # make `git up` work similar to svn up

Line endings

Although you might think you’re immune to CRLF-ended files on mac and linux, you are not. It is possible to download files from an external source that use CRLF, and thus commit them into your repo. You should globally set your config to convert line endings on commit so they are always LF in the repo (or omit the --global for paparazzi only):

git config --global core.autocrlf input

If you are on a windows box by any chance set:

git config --global core.autocrlf true


If you are an emacs user you might want to have a look at

git status in shell

For bash:

For zsh: