FlightGear Git on Windows: Difference between revisions

Jump to navigation Jump to search
→‎Commiting changes: Updated to be more clear and concise; note that all these steps apply to Linux too
mNo edit summary
(→‎Commiting changes: Updated to be more clear and concise; note that all these steps apply to Linux too)
Line 101: Line 101:
As a developer, you probably want to share your work with the world. For FlightGear, most developers do this by commiting 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 commiting stuff to the Git repository.


'''Only required once:'''
=== Getting started ===
# Register an account at [http://gitorious.org Gitorious].
# Register an account at [http://gitorious.org Gitorious].
# [http://gitorious.org/fg/fgdata/clone Clone fgdata].
# [http://gitorious.org/fg/fgdata/clone Clone fgdata].
Line 110: Line 110:
# Visit your dashboard at Gitorious and navigate to "Manage SSH keys".
# 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.
# Click the "Add SSH key" button and paste the content of the .pub file. Follow the instructions on the screen.
# Congratulations on finishing the setup procedure!
# 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/fgdta/'', 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.


{{WIP}}
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>''


'''Required with each update:'''
=== Pulling ===
* <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'').
To pull updates from the master fgdata repository,
* <branch name> is the name of your local branch.
* <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.


# Browse to the root of your updates (if you are commiting a new aircraft, this will be Aircraft/.../) and open Git Bash.
=== Pushing ===
# ''git checkout -b <branch name>''
{{WIP}}
# ''git checkout master''
To push local updates to your fgdata clone,
# ''git reset --hard HEAD'' <font color="red">'''Note: this will delete all local changes! If you made local changes, make sure to backup those first, outside your FlightGear data directory! Or, better, learn to commit your changes to your local git repository.''' Make a copy of our to-be-commited work somewhere out of your data/ directory before doing this, and move it back in after pulling.</font>
* <branch name> is the name of the local branch you want to push.
## Run ''git pull'' and let it update, this can take a while.
# ''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>''


# ''git pull'' to make sure you can commit against the latest Git.
==== Creating a merge request ====
# ''git push <url> +master'' You will have to enter your SSH passphrase. Press Enter when you're done (note: your passphrase is hidden!). Git will now commit your work, this can take a long time, depending on the number of commits that have been made since you cloned fgdata.
# Check that the commit to your fgdata clone is recognized by Gitorious.
# Switch to your local branch, by ''git checkout rendering-checkboxes''
# Run ''git status -- .'' to show the status of the current directory.
# Now, ''git add filename'' the files you want to include in the commit but that are currently listed under "Changed but not updated" or under "Untracked files". After adding a couple of files, redo step 4 to update the untracked list. Files that are listed as "deleted" can be added to the "to be commited" list with ''git rm filename''.
# Eventually, you will have everything you want to commit listed under "Changes to be committed:". You can verify what you have staged for committing by running ''git diff --cached'' which will show exactly what would be committed by git commit in the form of a diff.
# Run ''git commit -m "Summary of the update"'' (don't forget the " symbols!). Where you should write a short summary on what you changed.
# Now run ''git push <url> <branch name>''. You will have to enter your SSH passphrase again.
# Check that the commit to your fgdata clone is recognised 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!
# 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 rendering-checkboxes!
# 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.
# 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 till he accepts your merge request ;)
# 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].
# Run ''git status -- .'' to show the status of the current directory.
# Now, ''git add filename'' the files you want to include in the commit but that are currently listed under "Changed but not updated" or under "Untracked files". After adding a couple of files, redo step 4 to update the untracked list. Files that are listed as "deleted" can be added to the "to be commited" list with ''git rm filename''.
# Eventually, you will have everything you want to commit listed under "Changes to be committed:". You can verify what you have staged for committing by running ''git diff --cached'' which will show exactly what would be committed by git commit in the form of a diff.
# Run ''git commit -m "Summary of the update"'' (don't forget the " symbols!). Where you should write a short summary on what you changed.
-->
483

edits

Navigation menu