FlightGear Git: Difference between revisions

m
Robot: Cosmetic changes
m (Removed link to fgdata.bundle on Peter's server.)
m (Robot: Cosmetic changes)
Line 40: Line 40:


=== For dummies ===
=== For dummies ===
Some basic git commands on how to clone, update and handle local git repositories. Except the initial ''git clone'' for each repository all commands have to be executed from within the ''target'' folder.<BR>
Some basic git commands on how to clone, update and handle local git repositories. Except the initial ''git clone'' for each repository all commands have to be executed from within the ''target'' folder.<br />


==== Cloning SimGear ====
==== Cloning SimGear ====
Line 46: Line 46:
: the folder ''target'' will be created and a clone of the SimGear repo stored inside it. If no ''target'' is given the new folder's name is <code>simgear</code>.
: the folder ''target'' will be created and a clone of the SimGear repo stored inside it. If no ''target'' is given the new folder's name is <code>simgear</code>.


<b><code>cd</code></b> into the new folder. You are then inside the ''working tree'' of this git repo. The repo itself is stored inside the subfolder <tt>.git</tt>, which we mustn't edit manually. Git will take care of that.
'''<code>cd</code>''' into the new folder. You are then inside the ''working tree'' of this git repo. The repo itself is stored inside the subfolder <tt>.git</tt>, which we mustn't edit manually. Git will take care of that.


;<code>git branch</code>
;<code>git branch</code>
: will show the active [[FlightGear_and_Git#Repositories and Branches|branch]]. Right after download this will be <tt>* next</tt>, that means the content of the ''working tree'' is the bleeding edge of SimGear's source code.
: will show the active [[FlightGear and Git#Repositories and Branches|branch]]. Right after download this will be <tt>* next</tt>, that means the content of the ''working tree'' is the bleeding edge of SimGear's source code.
:;<code>git branch -a</code>
:;<code>git branch -a</code>
:: will list all branches of a git repository. The one marked with an asterisk (*) is the active one.
:: will list all branches of a git repository. The one marked with an asterisk (*) is the active one.


;<code>git checkout master</code>
;<code>git checkout master</code>
: will change the active [[FlightGear_and_Git#Repositories_and_Branches|branch]] to <tt>master</tt>. Means, that the content of the ''working tree'' will be changed to that state.
: will change the active [[FlightGear and Git#Repositories and Branches|branch]] to <tt>master</tt>. Means, that the content of the ''working tree'' will be changed to that state.


:;<code>git checkout v2.0.0</code>
:;<code>git checkout v2.0.0</code>
Line 66: Line 66:


==== Cloning FlightGear ====
==== Cloning FlightGear ====
Except for the initial clone command this is identic to [[FlightGear_and_Git#Cloning_SimGear|Cloning SimGear]].
Except for the initial clone command this is identic to [[FlightGear and Git#Cloning SimGear|Cloning SimGear]].
;<code>git clone git://gitorious.org/fg/flightgear.git [target]</code>
;<code>git clone git://gitorious.org/fg/flightgear.git [target]</code>
To successfully compile <code>fgfs</code> Flight- and SimGear's ''working tree'' must have the same state.
To successfully compile <code>fgfs</code> Flight- and SimGear's ''working tree'' must have the same state.
Line 72: Line 72:


==== Cloning fgdata ====
==== Cloning fgdata ====
At the time of writing the data repository is about ''2.6 GB''. Continuing an interrupted cloning of a repository is <b>not supported</b> 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 ''2.6 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]].


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 80: Line 80:
;<code>git clone git://mapserver.flightgear.org/fgdata/ [target]</code>
;<code>git clone git://mapserver.flightgear.org/fgdata/ [target]</code>
: if no ''target'' is given the new folder's name is <tt>fgdata</tt>
: if no ''target'' is given the new folder's name is <tt>fgdata</tt>
<b><code>cd</code></b> into the new directory and verify it's state with <b><code>git branch</code></b>. If it isn't <tt>* master</tt>, do a <b><code>git checkout master</code></b>.
'''<code>cd</code>''' into the new directory and verify it's state with '''<code>git branch</code>'''. If it isn't <tt>* master</tt>, do a '''<code>git checkout master</code>'''.




Line 86: Line 86:
To make individual changes, like editing a joystick file or add a plane to fgdata or patch the source code, it is recommended to create a local branch inside that repository. The following commands 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.
To make individual changes, like editing a joystick file or add a plane to fgdata or patch the source code, it is recommended to create a local branch inside that repository. The following commands 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.


<b><code>cd</code></b> into the repositories folder, e.g. fgdata:
'''<code>cd</code>''' into the repositories folder, e.g. fgdata:
;<code>git checkout -b master.local master</code>
;<code>git checkout -b master.local master</code>
: a new branch <tt>master.local</tt> is created out of the <tt>master</tt> branch and set as the active one. You may now apply your individual stuff there and start FlightGear to verify the changes are propper.
: a new branch <tt>master.local</tt> is created out of the <tt>master</tt> branch and set as the active one. You may now apply your individual stuff there and start FlightGear to verify the changes are propper.
Line 96: Line 96:
;<code>git add -i</code>
;<code>git add -i</code>
: will show the files that have been altered and give you options on what to do next. <code>git add</code> does not actually add the changes to ''master.local'' but adds them to the ''index''.
: will show the files that have been altered and give you options on what to do next. <code>git add</code> does not actually add the changes to ''master.local'' but adds them to the ''index''.
: <b><tt>[a]dd</tt></b> will add new paths/files (called ''untracked'' in status) from the ''working tree'' to the ''index''. This has to be done only if you have added paths/files, like an aircraft, to the ''working tree''.
: '''<tt>[a]dd</tt>''' will add new paths/files (called ''untracked'' in status) from the ''working tree'' to the ''index''. This has to be done only if you have added paths/files, like an aircraft, to the ''working tree''.
: If git finds more than one ''untracked'' file/path, it will give you a numbered list and prompt to select which ones should be added. An empty input will exit this mode. See "Interactive mode" in [http://www.kernel.org/pub/software/scm/git/docs/git-add.html man git add] for more details.
: If git finds more than one ''untracked'' file/path, it will give you a numbered list and prompt to select which ones should be added. An empty input will exit this mode. See "Interactive mode" in [http://www.kernel.org/pub/software/scm/git/docs/git-add.html man git add] for more details.
: <b><tt>[u]pdate</tt></b> is the next step and will update the altered and ''tracked'' files to the index in the same manner as explained in <tt>add</tt> untracked paths above.
: '''<tt>[u]pdate</tt>''' is the next step and will update the altered and ''tracked'' files to the index in the same manner as explained in <tt>add</tt> untracked paths above.
;<code>git commit</code>
;<code>git commit</code>
: will commit the ''indexed'' updates to the ''master.local'' branch. It opens a list of the updates in your standard editor. You may add a comment to that file describing the object of the commit. Save and exit the editor. You have now commited your changes inside the ''working tree'' to your personal branch.
: will commit the ''indexed'' updates to the ''master.local'' branch. It opens a list of the updates in your standard editor. You may add a comment to that file describing the object of the commit. Save and exit the editor. You have now commited your changes inside the ''working tree'' to your personal branch.
Line 155: Line 155:
  $ git checkout
  $ git checkout


If you get an error at <b><code>git fetch origin</code></b> try:
If you get an error at '''<code>git fetch origin</code>''' try:
  $ git remote rm origin
  $ git remote rm origin
  $ git remote add origin git://mapserver.flightgear.org/fgdata/
  $ git remote add origin git://mapserver.flightgear.org/fgdata/
  $ git fetch origin
  $ git fetch origin


For future updates just do a <b><code>git pull</code></b>.
For future updates just do a '''<code>git pull</code>'''.




==External links==
== External links ==
=== Git tutorials and resources ===
=== Git tutorials and resources ===
* Git [http://git-scm.com/documentation documentation and tutorials]
* Git [http://git-scm.com/documentation documentation and tutorials]