wiki:GitNotes

Version 2 (modified by stf, 9 years ago) (diff)

typos

Idiots guide to ffgit (fawkes-dev with git)

Setup and Config

To make any of the below working properly, you will need to establish a proper git configuration first!

 $>git config --global user.name  "Your Name"
 $>git config --global user.email "your.email@address.tld"

These will be checked against in our scpm-credential-automatisms, so be sure to get these right!

For your convenience, you might also want to establish some settings such as those for colored output as well as some handy aliases.

 $>git config --global color.ui "auto"
 $>git config --global color.status "auto"
 $>git config --global alias.br "branch"
 $>git config --global alias.ci "commit"
 $>git config --global alias.co "checkout"
 $>git config --global alias.st "status"

Clone Wars

The next thing you need to do is to clone the main repository. Get your initial clone of the main fawkes repository with

 $>git clone git@git.fawkesrobotics.org:fawkes.git

or one of

 $>git clone git@git.fawkesrobotics.org:fawkes-athome.git
 $>git clone git@git.fawkesrobotics.org:fawkes-gamebots.git
 $>git clone git@git.fawkesrobotics.org:fawkes-midsize.git
 $>git clone git@git.fawkesrobotics.org:fawkes-nao.git

to get the corresponding domain repository.

Since we have the main fawkes repo 'embedded' as a submodule in each of the domain repos, we need to initialize the same:

 $>git submodule update --init

In the most recent version of git, the two steps above can be done all in wonder:

 $>git clone --recursive git@git.fawkesrobotics.org:fawkes-gamebots.git

It's not a branch, it's a Feature Branch!

Proper git-based development in general and the fawkes development guidelines in particular advice to develop each (independent) feature in a separate "feature-branch". This enables to switch between different working contexts very easily.

To create such a branch and to check it out to start working you do:

 $>git checkout -b your-branch-name

where your-branch-name needs to be replaced appropriatedly. prefixing it with a shortcut of yourname and a self-explanatory (short) name of the feature that is being developed in the branch make things easier for others to follow.

Then you can start editing files and hacking the code.

 $>vi my_super_class.cpp
 $>...

Commit yourself (early and often)

Once you have achieved reasonable progress, you might want to commit the changes. To do so, you need to tell git what files should be included in the commit by "adding" them:

 $>git add a-changed-file.cpp a-modified-file.h a-newly-created-file.pl path/to/a/new/directory

Please note that you explicitely have to add all the stuff you want to be included:

  • modified files/directories
  • newly added files/directories
  • ...

Only then you should commit with

 $>git commit

Push the limit, push your branch

So far, you have only committed to your own branch in your own (local) clone of the repository. To share your development with others, you should push your branch to another repository.

 $>git push name-of-remote-repo name/of-local-branch:name/of-remote-branch
            ^                   ^                    ^
            |                   |                    +- name of the branch in the remote repo
            |                   +- name of the branch in your local repo
            +- name des remote repos

TODO:

 $>git push -u ...

merge

If your code was reviewed and should go to the master branch, you can merge your feature branch:

TODO

 $>git merge ...

Any news?

Get updates from the repo you cloned (the current branch) from by using

 $>git pull

TODO:

 $>git remote update

Ready or not: git stash

Put changes on hold for later

 $>git stash
 $>git stash list
 $>git stash apply

stuff to explain

Here or there? (git remote)

What is a remote and some convenience commands for the same

 $>git remote

Are you following me? (remote tracking branches)

Set up remote tracking branches with

 $>git ???