FlightGear Git on Windows: Difference between revisions

Jump to navigation Jump to search
m
Line 161: Line 161:


== Commiting changes ==
== Commiting changes ==
Everything from here onwards is only for developers.
As a developer, you probably want to share your work with the world. For FlightGear, most developers do this by committing stuff to the Git repository.
As a developer, you probably want to share your work with the world. For FlightGear, most developers do this by committing stuff to the Git repository.


=== Getting started ===
See [[FlightGear Git: data developers]] and/or [[FlightGear Git: core developers]].
# Register an account at [http://gitorious.org Gitorious].
# [http://gitorious.org/fg/fgdata/clone Clone fgdata].
# Open Git Bash in your data directory and run ''ssh-keygen''.
# Enter the name of the file in which you prefer to save the key and press Enter.
# Enter your password/passphrase and press Enter. You'll have to do this twice.
# Your key is now being generated. Open the .pub file with an editor (eg. Notepad++) and copy the content.
# Visit your dashboard at Gitorious and navigate to "Manage SSH keys".
# Click the "Add SSH key" button and paste the content of the .pub file. Follow the instructions on the screen.
# Open Git Bash in your data directory and run ''git remote add fgdata git://gitorious.org/fg/fgdata.git''. This adds a remote ref to the master fgdata repository in Gitorious. You can also add the mapserver URL by running ''git remote add fgdata-mapserver git://mapserver.flightgear.org/fgdata/'', which may be faster than Gitorious.
# Now run ''git remote set-url origin <url>'', where ''<url>'' is the line that you get by clicking SSH on your fgdata clone page at Gitorious (should be something like ''git@gitorious.org:~your/fg/yours-fgdata.git''). This switches the origin ref to the correct URL that Gitorious will take when updating.
 
It is recommended to split your new fgdata clone into separate local branches for your work. For instance, if you're working on the [[Boeing 747-400]] and the [[Howto: Aircraft Reflection Shader|aircraft reflection shader]], you might create 2 branches named "747-400" and "reflect-shader". To do this,
# ''git checkout master''
# ''git branch <branch name>''
# ''git checkout <branch name>''
 
Then you can make your changes to the new local branch(es), which will make merge requests easier for both yourself and committers. To switch in between branches, simply use
* ''git checkout <branch name>''
 
=== Pulling ===
To pull updates from the master fgdata repository,
* <branch name> is the name of the branch you want to update.
* &lt;ref&gt; is the repository ref. If you followed the [[#Getting Started|getting started]] section, this will be "fgdata" or "fgdata-mapserver".
# ''git checkout <branch name>''
# ''git pull &lt;ref&gt;''
# Assuming you got no merging errors, run ''git push origin <branch name>'' to push the updates out to Gitorious.
 
=== Pushing ===
{{WIP}}
To push local updates to your fgdata clone,
* <branch name> is the name of the local branch you want to push.
# ''git checkout <branch name>''
# Use ''git status --'' to list all the changed files.
## If you want to commit all changed files, run ''git commit -a'' and type your commit message.
## If you only want to commit some files, run ''git add <path/to/file>'' to add certain files (you can use ''git add --all <path/to/folder>'' to add all files within a certain folder) and ''git rm <path/to/file>'' to mark files you have removed for deletion in the repository.
# If you used ''git commit -a'', the commit has already been created for you. Otherwise, run ''git commit -m "<commit message>"'' (quotes required), where <commit message> is the message for your commit (i.e. "747-400: Improved lightmaps").
# ''git push origin <branch name>''
 
==== Rebase the development branch ====
Normally developments take some time, so the root of a development branch most likely will be outdated by the time the development is finished and a merge can be prepared. In order to make the merge easier for the contributor, it could be helpful to rebase the development branch to the current HEAD of the master.
 
Let <branch name> be the name of the local branch you want to push, that branch contains your work.
Furthermore, <tt>fgdata</tt> refers to the repository at <tt>git://gitorious.org/fg/fgdata</tt>, i.e. the official repository, whereas <tt>origin</tt> refers to your personal Gitorious repository.(You can use <code>git remote -v</code> to learn about all the remotes and their names.)
 
# Switch to that branch: <code>git checkout <branch name></code>
# Rebase your branch to the current HEAD of fgdata/master: <code>git rebase fgdata/master</code>
# Push your rebased development branch to your personal Gitorious repo
## First try <code>git push origin</code>. If that produces some warnings about merges, you can
## force it by using <code>git push origin -f</code> .
 
For more details on what rebasing does, check out http://book.git-scm.com/4_rebasing.html.
 
==== Creating a merge request ====
# Check that the commit to your fgdata clone is recognized by Gitorious.
# Click the "Request merge" button on your fgdata clone page. Loading the next page can take a while, as it will list all commits of the past years!
# Once again write a short summary (could be the same as used with git commit), but this time, also write an explanation of your merge request (what does it do). Make sure you set target repository to fgdata, Target Branch to master and Source Branch to the local branch with your updates.
# Tick the box in front of your commit and click the "Create merge request" button.
# Now, all you have to do is contact a [http://gitorious.org/+flightgear-developers contributor] and wait untill he accepts your merge request ;)


Creating merge requests using this method literally means merging an entire branch into fgdata; this may not be desirable for some situations, such as small changes that only require one little commit. There's a neat method to only push certain commits to a merge request discussed by Anders Gidenstam [http://flightgear.org/forums/viewtopic.php?f=4&t=10392&start=45#p115747 on the FlightGear Forums].
[[pl:FlightGear Git na Windows]]
[[pl:FlightGear Git na Windows]]

Navigation menu