Using a central git tree: Difference between revisions

From OLPC
Jump to navigation Jump to search
(..)
(+pre)
Line 5: Line 5:
=== 1. Clone the central tree to your local machine ===
=== 1. Clone the central tree to your local machine ===


<pre>
{{{
$ git clone git+ssh://dev.laptop.org/git/projects/MYPROJECT
$ git clone git+ssh://dev.laptop.org/git/projects/MYPROJECT
</pre>
}}}


You only ever need to do this once per each machine on which you do development. The same goes for telling git who you are:
You only ever need to do this once per each machine on which you do development. The same goes for telling git who you are:


<pre>
{{{
$ git repo-config user.name "FirstName LastName"
$ git repo-config user.name "FirstName LastName"
$ git repo-config user.email "user@example.com"
$ git repo-config user.email "user@example.com"
</pre>
}}}


== 2. Hack on the code ==
== 2. Hack on the code ==
Line 23: Line 23:
Use 'git add <file>' to add files to versioning. Delete files from the tree directly if you want them removed. Commit with:
Use 'git add <file>' to add files to versioning. Delete files from the tree directly if you want them removed. Commit with:


<pre>
{{{
$ git commit -a
$ git commit -a
</pre>
}}}


This will prompt for a commit message. You may add '-m "Commit message"' to specify it on the command line. Using -s will also add the Signed-off-by line commonly used in Linux development.
This will prompt for a commit message. You may add '-m "Commit message"' to specify it on the command line. Using -s will also add the Signed-off-by line commonly used in Linux development.
Line 31: Line 31:
== 4. Push commits upstream ==
== 4. Push commits upstream ==


<pre>
{{{
$ git push
$ git push
</pre>
}}}


If someone else has updated the tree since you last pulled from it, git will complain. In this case, do step 5, and then return to this one.
If someone else has updated the tree since you last pulled from it, git will complain. In this case, do step 5, and then return to this one.
Line 41: Line 41:
This is the equivalent of 'cvs update':
This is the equivalent of 'cvs update':


<pre>
{{{
$ git pull
$ git pull
</pre>
}}}


= Links =
= Links =

Revision as of 00:11, 18 April 2007

NB: this was originally copied from an original at dev.laptop.org; we are moving away from using that wiki; please make this the latest version in the future.

If you're familiar with centralized systems like CVS or SVN, this will be just learning a bit of new syntax.

1. Clone the central tree to your local machine

$ git clone git+ssh://dev.laptop.org/git/projects/MYPROJECT

You only ever need to do this once per each machine on which you do development. The same goes for telling git who you are:

$ git repo-config user.name "FirstName LastName"
$ git repo-config user.email "user@example.com"

2. Hack on the code

Pretty self-explanatory, we'd hope.

3. Do local commits

Use 'git add <file>' to add files to versioning. Delete files from the tree directly if you want them removed. Commit with:

$ git commit -a

This will prompt for a commit message. You may add '-m "Commit message"' to specify it on the command line. Using -s will also add the Signed-off-by line commonly used in Linux development.

4. Push commits upstream

$ git push

If someone else has updated the tree since you last pulled from it, git will complain. In this case, do step 5, and then return to this one.

5. Pull upstream commits

This is the equivalent of 'cvs update':

$ git pull

Links

This is just a summary. For detailed help, see: