- 1 Git help and resources
- 2 Before You Start
- 3 Get the code
- 4 Get to work
- 5 Advanced Configuration and helpful tools
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.
To get an understanding off the git internals the video Getting Git is excellent.
- git screencasts
- git help from github
- git communitiy book
- ProGit book
- git ready - short tips
- nice Git reference
- more Git cheat sheets
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 user.name "Your Name" git config --global user.email email@example.com
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
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> firstname.lastname@example.org:<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.
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://github.com/paparazzi/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 email@example.com:paparazzi/paparazzi.git
Option 2: clone from github without an account
Otherwise clone directly from the master repo (read-only):
git clone git://github.com/paparazzi/paparazzi.git
or if you are behind a firewall with an http proxy available:
Get to work
To show the status (modified and staged changes) you can run
Gitk is your friend if you want to visualize all remotes/branches and history:
Pull and push
Have a look at the very good short overview of pushing and pulling on gitready.com.
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 alias.st status # make `git st` work git config --global alias.co checkout # make `git co` work git config --global alias.ci commit # make `git ci` work git config --global alias.br branch # make `git br` work git config --global alias.up "pull --rebase" # make `git up` work similar to svn up
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. To be safe, you should set your config to convert line endings on commit so they are always LF in the repo:
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 http://philjackson.github.com/magit/
git status in shell
For zsh: http://www.wunjo.org/zsh-git/