FlightGear Git: Difference between revisions

Jump to navigation Jump to search
review complete
m (Still updating - final merge to GIT still in review)
(review complete)
Line 1: Line 1:
{{FlightGearGitOn}}
'''Git''' is a version control system used by the [[FlightGear]] project to store all of the files required to build the FlightGear, including all the programs, the data (e.g. [[aircraft]]), supporting tools, etc. Git tracks updates to every file as developers around the world work together concurrently to create new versions.  
'''Git''' is a version control system used by the [[FlightGear]] project to store all of the files required to build the FlightGear, including all the programs, the data (e.g. [[aircraft]]), supporting tools, etc. Git tracks updates to every file as developers around the world work together concurrently to create new versions.  


While new FlightGear features and additions are in development, they are available from Git before they are available in the standard release version. Using Git allows users to build the newest possible version of FlightGear from the latest source files, to experiment with new aircraft or other features. However, it's not a beginner's tool. Using Git can expose the user to unstable features that show ugly error messages, or crash the computer.  
While new FlightGear features and additions are in development, they are available from Git before they are available in the standard release version. Using Git allows users to build the newest possible version of FlightGear from the latest source files, to experiment with new aircraft or other features. However, it's not a beginner's tool. Using Git can expose the user to unstable features that show ugly error messages, or crash the computer.  


In May 2010, after a hardware failure on the [[CVS]] servers, the FlightGear project changed version control system from CVS to Git. The Git repositories are located at [http://gitorious.org/fg Gitorious] and a mirror is hosted at the [http://mapserver.flightgear.org/git/?p=fgdata;a=summary Mapserver].
In May 2010, after a hardware failure on the [[CVS]] servers, the FlightGear project changed its version control system from CVS to Git. The Git repositories are located at [http://gitorious.org/fg Gitorious] and a mirror is hosted at the [http://mapserver.flightgear.org/git/?p=fgdata;a=summary Mapserver].


Due to the "recent" switch, we are currently doing our best on providing manuals for obtaining FlightGear through Git. The following articles are work in progress:
Due to the "recent" switch, we are currently doing our best on providing manuals for obtaining FlightGear through Git. The following articles belong to that "work in progress":
* '''Mac OS X:''' [[FlightGear Git on Mac OS X]]
* [[FlightGear Git on Mac OS X]]
* '''Windows:''' [[FlightGear Git on Windows]]
* [[FlightGear Git on Windows]]
* in addition [[Howto:Start using git]] provides a quick introduction to using git.
* [[Howto:Start using git]] provides a quick introduction to using a "source code management system"
<br />
<br />


== '''Motivation''' ==
== '''Motivation''' ==
Much has been written on the advantages of Git over CVS. For the FlightGear project, some advantages are:
Much has been written on the advantages of Git over CVS. For the FlightGear project, some advantages are:
* Much better support for branches and merging branches. This is especially important for creating bug-fix releases for major releases while still allowing work on the next major release to continue. It is also very nice for a developer's personal workflow.
* Much better support for branches and merging branches. This is especially important for creating bug-fix releases for major releases while still allowing work on the next major release to continue. It is also very nice for a developer's personal work-flow.
* Easier path for contributors to submit changes and developers to integrate them.
* Easier path for contributors to submit changes and developers to integrate them.
* Much better support for everyday tasks like searching the project history for changes, viewing changes, bisecting the project history to find the original source of a bug.
* Much better support for everyday tasks like searching the project history for changes, viewing changes, bisecting the project history to find the original source of a bug.
Line 22: Line 21:


== '''Manipulating the GIT''' ==
== '''Manipulating the GIT''' ==
=== Overview ===
=== Work-flow Overview===
[[File:GIT-Workflow.png|Cloning and manipulating the GIT]]
{|
||[[File:GIT-Workflow.png]]
|}
For a detailed description see the description of the 4 repositories (A,B,C,D) in the following chapters
For a detailed description see the description of the 4 repositories (A,B,C,D) in the following chapters
<br /><br />
<br /><br />
=== A) Repositories and branches ===
=== A) Repositories and branches ===
For historical reasons there continue to be separate repositories for [[SimGear]] and FlightGear '''source'''. For most users and developers the most interesting ones of each are:
For historical reasons there continue to be separate repositories for [https://gitorious.org/fg/simgear '''''SimGear'''''] and [https://gitorious.org/fg/flightgear '''''FlightGear''''']. For most users and developers the most interesting ones for those 2 are:
 
* '''''next''''': The current tip of new development. This branch should always compile and run, but various things could be broken.
* <tt>next</tt> The current tip of new development. This branch should always compile and run, but various things could be broken.
* '''''release/*''''': The branch subdirectory containing former and ''(if there is already defined one)'' upcoming releases.
* <tt>release/*</tt> The branch subdirectory containing former and, if there is one, upcoming releases.
For all available branches see https://gitorious.org/fg/simgear/trees and/or https://gitorious.org/fg/flightgear/trees
For other available branches have a look at our [http://gitorious.org/fg/flightgear#more repository] at gitorious.org. The following two branches are as of now (May 2011) very much out of date. '''Do not use'''.
<br /><br />
* <tt>master</tt> The tip of stable, tested new features. If we were to make a new release today, we would start from the tip of this branch. New features that have been "cooking" in the <tt>next</tt> branch for a few days or weeks will be merged here.
FlightGear [https://gitorious.org/fg/fgdata '''''data''''''s] branches of interest are:
* <tt>maint</tt> Bug fixes for the most recently released Flightgear. When a release is made from <tt>master</tt>, this branch is reset to it.
* '''''master''''': The one that is used with the '''''next''''' branch of the code.
 
* '''''release/*''''': The one that is used with the '''''release''''' branch of the code.
FlightGear '''data''''s branches of interest are:
For all available branches see https://gitorious.org/fg/fgdata/trees
* <tt>master</tt> The one that is used with the <tt>next</tt> branch of the source.
<br /><br />
* <tt>release/*</tt> Same as for the source.
For other available projects have a look at our [http://gitorious.org/fg gitorious.org]. Use the "Source tree" button to see all available branches unique to those projects.
 
<br /><br />
This arrangement follows the scheme used by the Git maintainers. [http://www.kernel.org/pub/software/scm/git/docs/howto/maintain-git.txt This description] is very technical; you will surely have achieved git-fu if completely understand it. However, the idea of maintaining several branches of different stability is common in collaborative software projects.
'''''Warning:'''''
*The "fgdata" project will be used in all following examples - thus the "Prime" local repository will always be named "master"!
*If you do test changes, make sure all branches have the same status - otherwise your setup may not be functional!
<br /><br />
<br /><br />
=== B) Create your own workspace on Gitorious ===
=== B) Create your own workspace on Gitorious ===
Line 52: Line 55:
* getstart
* getstart
* etc.
* etc.
Create your own "GIT-Clone" ''(as a space to work in)'' by activating the "Clone repository" button of the wanted project. By default you will be cloning the '''''next''''' branch of that project --> that is the actual repository including the newest, not yet formally distributed, changes. That is probably what you want if you want to  
Create your own "GIT-Clone" ''(as a space to work in)'' by activating the "Clone repository" button of the wanted project. By default you will be cloning the '''''next''''' or '''''master''''' branch of that project --> that is the actual repository including the newest, not yet formally distributed, changes. That is probably what you want if you want to  
* assist with reporting bugs before they are released as a proper release version
* assist with reporting bugs before they are released as a proper release version
* or participate in the design
* or participate in the design
* or similar
* or similar


If you are interested in other branches/versions see the button "Source Tree".
The created GIT-clone will be on you private page '''https://gitorious.org/~<small>YourUID</small>'''
But '''''keep in mind:''''' To successfully compile <code>fgfs</code> Flight- and SimGear's ''working tree'' must have the same state!
<small>''("YourUID" being your ID you logged in with, and do not forget the "~" in front of it!)''</small>)
 
The created GIT-clone will be '''https://gitorious.org/~YourUID'''
<small>''("YourUID" being your ID you logged in with, and do not forgett the "~" in front of it!)''</small>)
<br /><br />
<br /><br />
=== C) Create a "master" on your local PC ===
=== C) Create a "master" on your local PC ===
''All the following is shown as performed in an UBUNTU "Terminal" environment! Please adapt especially the directory trees according to your Operating-System!''
''All the following is shown as performed in an UBUNTU "Terminal" environment! Please adapt especially the directory trees according to your Operating-System!''
# Create a unique folder on your PC, e.g. "..'''\GIT'''"
# Create a unique folder on your PC, e.g. "..'''\GIT'''"
# change into that folder and use the "git clone" commands to clone the wanted repository
# change into that folder and use the following "git clone" commands to clone the wanted repository
#* ''if you need/want more informations about unique GIT-commands, input "git help [command]"'' <small>(e.g. "git help clone")</small>
#* ''if you need/want more informations about unique GIT-commands, input "git help [command]"'' <small>(e.g. "git help clone")</small>
# use one of the following commands (or similar) from within that "..'''\GIT'''"-folder:
# use one of the following commands (or similar) from within that "..'''\GIT'''"-folder:
Line 83: Line 83:


'''<code>cd</code>''' into the new folder [target]
'''<code>cd</code>''' into the new folder [target]
:You are now inside the ''working tree'' of this git repo. The repo itself is stored inside the subfolder <tt>../GIT/[target]/.git</tt>, which we mustn't edit manually. Git will take care of that.
:You are now inside the ''working tree'' of this git repository. The repository itself is stored inside the subfolder <tt>../GIT/[target]/.git</tt>, which we mustn't edit manually. Git will take care of that.
<small>Notice the "'''.'''" in front of the name: In Linux that indicates a hidden file, for which you might have to enable "show hidden files"!</small>
:<small>Notice the "'''.'''" in front of the name: In Linux that indicates a hidden file, for which you might have to enable "show hidden files"!</small>


;<code>git branch</code>
;<code>git branch</code>
: will show the active [[FlightGear and Git#Repositories and Branches|branch]].  e.g.
: will show the active [[FlightGear_and_Git#A.29_Repositories_and_branches|branches]].  e.g.
<small>
<small>
  ..GIT/fgdata$ '''git branch'''
  ..GIT/fgdata$ '''git branch'''
  * master
  * master
   master.local  <small>''(<-- this branch will not be there initially!)''</small>
   master.local  <small>''(<-- this branch will not be there initially!)''</small>
:</small>Right after download the active GIT-repository-branch will be <tt>'''"next"'''</tt>, which on your PC is called "master". The "'''*'''" in front means that this is now the active one! i.e. the content of the active ''working tree'' is the bleeding edge of the source code.
:</small>Right after download the active GIT-repository-branch will be <tt>'''"next"'''</tt>, which in the example is called "master". The "'''*'''" in front means that this is now the active one! i.e. the content of the active ''working tree'' is the bleeding edge of the source code.


;<code>git branch -a</code>
;<code>git branch -a</code>
Line 111: Line 111:


You now have your local "GIT-master".
You now have your local "GIT-master".
'''But:''' To make individual changes ''(like editing a joystick file)'' add a plane to fgdata or patch the source code. It is always recommended to create a local branch inside that "master" repository. In the chapter "[[FlightGear and Git#D) Editing Data|D) Editing Data]]" we will describe a way to achieve this. But have in mind, that this is very basic and only suits for users who have minor changes.  
'''But:''' To make individual changes ''(like editing a joystick file)'' add a plane to fgdata or patch the source code. It is always recommended to create a local branch inside that "master" repository. In the chapter "[[FlightGear_and_Git#Edit|Edit]]" we will describe a way to achieve this. But have in mind, that this is very basic and only suits for users who have minor changes.  
<br /><br />
<br /><br />
==== Special for '''fgdata''':====
==== Special for '''fgdata''':====
At the time of writing the data repository is about ''3.4 GB''. Continuing an interrupted cloning of a repository is '''not supported''' with git. Therefore, if you have a slow or unstable connection to the internet, it is recommended to download the [[FlightGear and Git#fgdata.bundle|fgdata.bundle]].
At the time of writing the data repository is about ''3.4 GB''. Continuing an interrupted cloning of a repository is '''not supported''' within git. Therefore, if you have a slow or unstable connection to the internet, it is recommended to download the [[FlightGear and Git#fgdata.bundle|fgdata.bundle]].


Also have in mind, that the repository plus the ''working tree'' will be more than twice the size of the download on your local filesystem.
Also have in mind, that the repository plus the ''working tree'' will be more than twice the size of the download on your local filesystem.
Line 121: Line 121:


==== fgdata.bundle ====
==== fgdata.bundle ====
For the FlightGear-data there are also bundles (snapshots) available that can be retrieved with your favourite download manager. This way you can resume interrupted downloads. After unpacking only a comparatively small amount of data has to be transferred from the git server to synchronize your repository.
For the FlightGear-data there are bundles (snapshots) available that can be retrieved with your favourite download manager. This way you can resume interrupted downloads. After unpacking only a comparatively small amount of data has to be transferred from the git server to synchronize your repository.


Download the bundle from
Download the bundle from
Line 130: Line 130:
  145f4e190fd1a02fd75c1d508b8c2ec3  fgdata.bundle  
  145f4e190fd1a02fd75c1d508b8c2ec3  fgdata.bundle  


Caution: should be that. If the bundle is updated, not be the same.
'''''Caution:''''' If a bundle is updated, the checksum changes!


Do the following steps to extract the bundle and bring the repository up to date:
Do the following steps to extract the bundle and bring the repository up to date:
Line 169: Line 169:
  Your branch is ahead of 'origin/master' by 2 commits.
  Your branch is ahead of 'origin/master' by 2 commits.
</small>
</small>
:you need to resync your master with e.g.:
:you should re-sync your master with e.g.:
:;<code>git fetch</code>
:;<code>git fetch</code>
<br />
<br />
Line 177: Line 177:
  Switched to a new branch 'master.local'
  Switched to a new branch 'master.local'
</small>
</small>
:Gnerates the new "master.local" and switches to it.
:Generates the new "master.local" and switches to it.
:In case you get the response  
:In case you get the response  
<small>
<small>
Line 188: Line 188:
<br /><span style="color:green">
<br /><span style="color:green">
'''''You may now
'''''You may now
*apply your planned changes into the affected "/GIT/subdir"
*'''''apply your planned changes''''' into the affected "/GIT/subdir"
*start FlightGear to verify they are proper/functional
*start FlightGear to verify they are proper/functional
*then check what was done:'''''
*then check what was done:'''''
</span><br />
</span><br />
;<code>git status</code>
;<code>git status</code>
:''(the output may take some time to appear!
:<small>the output may take some time to appear!</small>
:see e.g. a dummy-example:)''
:see e.g. a dummy-example:
<small>
<small>
  ..GIT/fgdata$ '''git status'''
  ..GIT/fgdata$ '''git status'''
Line 243: Line 243:
===="Commit"====
===="Commit"====
;<code>git commit -m "''your short, accompanying Announcement''"</code>
;<code>git commit -m "''your short, accompanying Announcement''"</code>
: will commit the updates to the ''master.local'' branch. It shows a list compatible to the one created with the "git status" before, but this time this created something new! ''(Yes: You could have omitted the "git status" and just did the "commit" - but we suggest to "double-check" this way!)''
: will commit the updates to the ''master.local'' branch. It shows a list compatible to the one created with the "git status" before, but this "git commit" created something new! ''(Yes: You could have omitted the "git status" and just did the "commit" - but we suggest to "double-check" it this way!)''


;<code>git log</code>
;<code>git log</code>
Line 257: Line 257:
: You definitely should now copy the ID ''(the first 8 digits may be enough)'' to use it later as a unique identifier!
: You definitely should now copy the ID ''(the first 8 digits may be enough)'' to use it later as a unique identifier!


<br />
Now return to your local "master" with:
Now return to your local "master" with:
;<code>git checkout master</code>
;<code>git checkout master</code>


;<code><nowiki>git fetch git://gitorious.org/fg/fgdata.git</nowiki></code>
;<code><nowiki>git fetch git://gitorious.org/fg/fgdata.git</nowiki></code>
:<small>replace in that line the "fgdata.git" with the repository you are actually working on</small>
:''replace in that line the "fgdata.git" with the repository you are actually working on''
:this will update the master to the newest GIT-level ''(there may have been changes during all that time!)''
:this will update the master to the newest GIT-level ''(there may have been changes during all that time!)''


;<code>git cherry-pick 7658c67c</code>
;<code>git cherry-pick 7658c67c</code>
:<small>replace the "7658c67c" with the first digits of your commit-ID (see above "git log")</small>
:''replace the "7658c67c" with the first digits of your commit-ID (see above "git log")''
:will pull the commit into the "master"
:will pull the commit into the "master"


Line 272: Line 273:
<br />
<br />
=== Push your changes to your clone on Gitorious ===
=== Push your changes to your clone on Gitorious ===
;<code>git push git@gitorious.org:~YourID/fg/YourIDs-fgdata.git</code>
;<code>git push git@gitorious.org:~<small>YourUID</small>/fg/<small>YourUID</small>s-fgdata.git</code>
<small>
<small>
::replace "YourID" with your login-name for Gitorious, do not forget the "~" in front of it!
::replace "YourID" with your login-name for Gitorious, do not forget the "~" in front of it!
Line 280: Line 281:


Now you can announce to GIT that you have a change that may be merged into the original GIT:
Now you can announce to GIT that you have a change that may be merged into the original GIT:
*Open your git-clone on Gitorious: https://gitorious.org/~YourID/fg/YourID-fgdata
*Open your git-clone on Gitorious: https://gitorious.org/~<small>YourUID</small>/fg/<small>YourUID</small>-fgdata
*and click the "Request merge" button on the right:
*and click the "Request merge" button on the right:
<br />
<br />
Line 286: Line 287:
||[[File:Create merge request at Gitorious.png|left|thumb|270px|Creating a merge request at Gitorious.]]||
||[[File:Create merge request at Gitorious.png|left|thumb|270px|Creating a merge request at Gitorious.]]||
Write a short summary in which you explain what your commit(s) do. Then choose the following settings:
Write a short summary in which you explain what your commit(s) do. Then choose the following settings:
: '''Target directory:''' fgdata
: '''Target directory:''' fgdata or FlightGear or SimGear
: '''Target branch:''' master
: '''Target branch:''' master or next or whatever
: '''Source branch:''' master
: '''Source branch:''' master or next or whatever
Next select the commits you'd like to include in your merge request and click "Create merge request".
Next select the commits you'd like to include in your merge request and click "Create merge request".
|}
|}
Line 294: Line 295:
<span style="color:red">'''''This step is for developers with fgdata commit access only!'''''</span>
<span style="color:red">'''''This step is for developers with fgdata commit access only!'''''</span>
<br />
<br />
See e.g. https://gitorious.org/+flightgear-developers/memberships  
For a list of those authorized see: https://gitorious.org/+flightgear-developers/memberships  
<br />
<br />
To push merge request to fgdata, the following workflow can be followed:
To push a merge request to fgdata, the following work-flow can be followed:
  git checkout -b integration # the integration branch should not yet exist. You can use any name you'd like
  git checkout -b integration # the integration branch should not yet exist. You can use any name you'd like
  git pull git://gitorious.org/fg/fgdata.git refs/merge-requests/1 # make sure you change 1 to the id of the merge request
  git pull git://gitorious.org/fg/fgdata.git refs/merge-requests/1 # make sure you change 1 to the id of the merge request
Line 308: Line 309:
=== Some more helpful commands ===
=== Some more helpful commands ===
;<code>git help</code>
;<code>git help</code>
;<code>git help [commad]</code>
;<code>git help [command]</code>
;<code>git apply</code>
;<code>git apply</code>
: apply a patch to files and/or to the index http://www.kernel.org/pub/software/scm/git/docs/git-apply.html
: apply a patch to files and/or to the index http://www.kernel.org/pub/software/scm/git/docs/git-apply.html
Line 324: Line 325:
* Git [http://git-scm.com/documentation documentation and tutorials]
* Git [http://git-scm.com/documentation documentation and tutorials]
* Git Basics [http://schacon.github.com/git/gittutorial.html]
* Git Basics [http://schacon.github.com/git/gittutorial.html]
* Git as a [http://tomayko.com/topics/git way of life].
* The [http://zrusin.blogspot.com/2007/09/git-cheat-sheet.html Git Cheat Sheet] and the [http://jan-krueger.net/development/git-cheat-sheet-extended-edition Git Cheat Sheet Extended Edition]
* The [http://zrusin.blogspot.com/2007/09/git-cheat-sheet.html Git Cheat Sheet] and the [http://jan-krueger.net/development/git-cheat-sheet-extended-edition Git Cheat Sheet Extended Edition]
* [http://wiki.github.com/bogolisk/egg Egg], a cool Git emacs mode.
* [http://wiki.github.com/bogolisk/egg Egg], a cool Git emacs mode.
* A guide to [http://nathanj.github.com/gitguide/ using Git on Windows]
* A guide to [http://nathanj.github.com/gitguide/ using Git on Windows]
* [http://kylecordes.com/2008/04/30/git-windows-go/ Git on Windows Go!] (Setting up msysgit on Windows)
* [http://kylecordes.com/2008/04/30/git-windows-go/ Git on Windows Go!] (Setting up msysgit on Windows)
* [http://gitcasts.com/posts/git-on-windows Git on Windows (webcast)]
* [http://sourceforge.net/projects/qgit qgit - interactive git repository viewer and frontend]
* [http://sourceforge.net/projects/qgit qgit - interactive git repository viewer and frontend]
* Additional [[Resources WRT running git on Win32]]
* Additional [[Resources WRT running git on Win32]]
652

edits

Navigation menu