GitForLunarDevs
Introduction
This is a skeleton page based on a discussion with Ratler on #lunar. Git can be easier than the man pages would suggest as long as someone shows you the way.
The page name is a bit naff - how about Git 101 for Lunar Developers or Sharing Git Repositories with Lunar Developers? Other ideas?
Please feel free to add comments/corrections - engelsman
Creating a local copy of the central moonbase repository
Git convention requires user name and e-mail address to appear in commit messages, etc. Note that the first two commands set these for all your repositories.
satellite$ git config --global user.name "Full Name" satellite$ git config --global user.email "username@domain.name" satellite$ git clone git://lunar-linux.org/lunar/moonbase.git
If you are already a true Lunar developer, rather than an enthusiastic helper, you will need to do things slightly differently so that you can propagate your changes back to the central moonbase repository using your Lunar username and password [*]:
satellite$ git config --global user.name "Full Name" satellite$ git config --global user.email "username@lunar-linux.org" satellite$ git clone ssh://username@lunar-linux.org/var/git/lunar/moonbase.git
[*] Or is there a better way for setting the ssh username after the initial 'git clone git://...' ?
Tracking a Lunar developer's moonbase repository
Some developers have made their copies of their personal repositories, with branches, available at a central URL. [How?] If you wanted to access florin's repository, for example, you would first have to tell your own moonbase repository about it:
satellite$ cd moonbase.git satellite$ git add remote florin git://foo-projects.org/florin/moonbase.git satellite$ git fetch florin
Creating a local branch copy of a Lunar developer's branch
satellite$ cd moonbase.git satellite$ git branch -a # should show remote/*/* branches satellite$ git checkout -b florin remotes/florin/florin
If you look in .git/config you should now see:
- You have a new remote section pointing at florin's url;
- You have a new branch named florin that refer to refs/heads/florin.
Copying/updating files from a remote Lunar developer's branch
satellite$ cd moonbase.git satellite$ git checkout florin satellite$ git pull
Adding a new branch from a remote Lunar developer's repository
satellite$ cd moonbase,git satellite$ git checkout florin satellite$ git remote update florin satellite$ git branch -a # should now show new 'xyz' branch satellite$ git checkout -b florin_xyz remotes/florin/xyz