Using a central git tree: Difference between revisions
mNo edit summary |
No edit summary |
||
(6 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
⚫ | |||
:''NB: this was originally copied from an original at [http://dev.laptop.org/wiki/CentralTree 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. |
If you're familiar with centralized systems like CVS or SVN, this will be just learning a bit of new syntax. |
||
== Identify yourself == |
|||
⚫ | |||
Tell git who you are: |
|||
<pre> |
<pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
</pre> |
</pre> |
||
You only ever need to do this once per each machine on which you do development. |
This is used in commit messages. You only ever need to do this once per each machine on which you do development. |
||
⚫ | |||
Using a git over ssh, if you have an account on dev.laptop.org, |
|||
<pre> |
<pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
</pre> |
</pre> |
||
or if you have no account, |
|||
⚫ | |||
<pre> |
|||
$ git clone git://dev.laptop.org/projects/MYPROJECT |
|||
</pre> |
|||
You only ever need to do this once per each machine on which you do development. |
|||
⚫ | |||
Pretty self-explanatory, we'd hope. |
Pretty self-explanatory, we'd hope. |
||
== |
== Do local commits == |
||
Use |
Use {{code|git add <file>}} to add files to version control. Delete files from the tree directly if you want them removed, or use {{code|git rm <file>}}. Commit with: |
||
<pre> |
<pre> |
||
Line 29: | Line 41: | ||
</pre> |
</pre> |
||
This will |
This will ask for a commit message using a text editor. You may add {{code|-m "Commit message"}} to specify it on the command line. Use {{code|-s}} to add the Signed-off-by line commonly used in Linux kernel development. |
||
== |
== Push commits upstream == |
||
<pre> |
<pre> |
||
Line 37: | Line 49: | ||
</pre> |
</pre> |
||
If someone else has updated the tree since you last pulled from it, git will complain. In this case, do |
If someone else has updated the tree since you last pulled from it, and git cannot resolve the changes easily, git will complain. In this case, do a {{code|git pull --rebase}}, and then repeat the push. |
||
== |
== Pull upstream commits == |
||
This is the equivalent of ' |
This brings to your machine the changes made by others. It is the CVS equivalent of ''update'': |
||
<pre> |
<pre> |
||
Line 47: | Line 59: | ||
</pre> |
</pre> |
||
= |
= See also = |
||
This is just a summary. For detailed help, see: |
|||
{{:Git/See also}} |
|||
* [http://www.kernel.org/pub/software/scm/git/docs/tutorial.html Basic git tutorial] |
|||
* [http://www.kernel.org/pub/software/scm/git/docs/everyday.html Everyday git with 20 commands] |
|||
* [http://www.kernel.org/pub/software/scm/git/docs/cvs-migration.html git for CVS users] |
|||
* [[Git]] |
|||
[[Category:Software]] |
[[Category:Software]] |
||
[[Category:Developers]] |
[[Category:Developers]] |
||
[[Category:Git]] |
|||
[[Category:Software development]] |
[[Category:Software development]] |
Latest revision as of 05:02, 2 July 2014
See importing your project if you're importing a new project to the OLPC servers -- because you'll have to do a few extra things before you can get up and running.
If you're familiar with centralized systems like CVS or SVN, this will be just learning a bit of new syntax.
Identify yourself
Tell git who you are:
$ git config user.name "FirstName LastName" $ git config user.email "user@example.com"
This is used in commit messages. You only ever need to do this once per each machine on which you do development.
Clone the central tree
Using a git over ssh, if you have an account on dev.laptop.org,
$ git clone git+ssh://dev.laptop.org/projects/MYPROJECT
or if you have no account,
$ git clone git://dev.laptop.org/projects/MYPROJECT
You only ever need to do this once per each machine on which you do development.
Hack on the code
Pretty self-explanatory, we'd hope.
Do local commits
Use git add <file> to add files to version control. Delete files from the tree directly if you want them removed, or use git rm <file>. Commit with:
$ git commit -a
This will ask for a commit message using a text editor. You may add -m "Commit message" to specify it on the command line. Use -s to add the Signed-off-by line commonly used in Linux kernel development.
Push commits upstream
$ git push
If someone else has updated the tree since you last pulled from it, and git cannot resolve the changes easily, git will complain. In this case, do a git pull --rebase, and then repeat the push.
Pull upstream commits
This brings to your machine the changes made by others. It is the CVS equivalent of update:
$ git pull
See also
- Git
- Using a central git tree
- Importing your project
- Creating a personal git tree
- Git tips
- Project hosting
- git home page
- Read more about git on Wikipedia
- Freedesktop Git
- Guide to git for SVN users