Difference between revisions of "Guide to FS Open and git"

From FreeSpace Wiki
Jump to: navigation, search
(2nd section text done)
(done for now)
Line 6: Line 6:
 
* Download and install [http://code.google.com/p/tortoisegit/ TortoiseGit] (you probably need to reboot after installing)
 
* Download and install [http://code.google.com/p/tortoisegit/ TortoiseGit] (you probably need to reboot after installing)
 
* Make a new folder on your HDD where you'd like to install the code. You'll need a fair bit of space for the code + the intermediate files when building it. Press right mouse and choose Git Clone from the list.
 
* Make a new folder on your HDD where you'd like to install the code. You'll need a fair bit of space for the code + the intermediate files when building it. Press right mouse and choose Git Clone from the list.
(piccy)
+
[[File:Git-clone-1.png]]
 
* A new window will open up. Cut and paste the URL of the FSO Github repository into the URL of repository box (https://github.com/scp-fs2open/fs2open.github.com.git)
 
* A new window will open up. Cut and paste the URL of the FSO Github repository into the URL of repository box (https://github.com/scp-fs2open/fs2open.github.com.git)
(piccy)
+
[[File:Git-clone-2.png]]
 
* Press OK to begin downloading from the repository (this may take a few minutes, depending on the speed of your internet connection)
 
* Press OK to begin downloading from the repository (this may take a few minutes, depending on the speed of your internet connection)
  
Line 18: Line 18:
 
* Go to the [https://github.com github webpage] and create an account
 
* Go to the [https://github.com github webpage] and create an account
 
* Go to the [https://github.com/scp-fs2open/fs2open.github.com FSO repository on github] and click on Fork
 
* Go to the [https://github.com/scp-fs2open/fs2open.github.com FSO repository on github] and click on Fork
(piccy)
+
[[File:Github-fork.png]]
 
* Record the URL for your newly forked copy of the FSO repository
 
* Record the URL for your newly forked copy of the FSO repository
(piccy)
+
[[File:Github-fork-2.png]]
 
* Get the code per the guide above (fix with proper intra-page link)
 
* Get the code per the guide above (fix with proper intra-page link)
 
** Note: you need to use the URL for '''your forked repository''', not the main FSO repository listed above
 
** Note: you need to use the URL for '''your forked repository''', not the main FSO repository listed above
 
* Right click on the repository directory and select TortoiseGit -> Create Branch
 
* Right click on the repository directory and select TortoiseGit -> Create Branch
 
** Note: all development should be done in a new branch, instead of being done in the "master" branch. It's just simpler
 
** Note: all development should be done in a new branch, instead of being done in the "master" branch. It's just simpler
(piccy)
+
[[File:Git-branch-1.png]]
 
* In the new window, enter the name for the new branch, verify that the branch is based on HEAD (master) and check the "Switch to new branch" box
 
* In the new window, enter the name for the new branch, verify that the branch is based on HEAD (master) and check the "Switch to new branch" box
(piccy)
+
[[File:Git-branch-2.png]]
 
* Write some code with your Editor of Choice
 
* Write some code with your Editor of Choice
 
* Test your new code
 
* Test your new code
 
* When you're happy with the code, right click on the repository directory and select TortoiseGit -> Diff
 
* When you're happy with the code, right click on the repository directory and select TortoiseGit -> Diff
(piccy)
+
[[File:Git-commit-1.png]]
 
* Review your changes by double-clicking on all the files listed in the new window (ensure no unwanted changes have snuck in!).
 
* Review your changes by double-clicking on all the files listed in the new window (ensure no unwanted changes have snuck in!).
** Note: this will start TortoiseGitMerge (also used to resolve conflicts)
+
[[File:Git-commit-2.png]]
(piccy)
+
* This is how the diff will be displayed (using TortoiseGitMerge, which is also used to resolve conflicts)
* When your review is complete, press "Commit"
+
[[File:Git-commit-3.png]]
(piccy)
+
* When your review is complete, press "Commit" (in the same window that you double clicked on all the changed files)
 
* In the new window, add a commit message and press OK
 
* In the new window, add a commit message and press OK
** Note: you can commit multiple times before pushing (e.g. you have coded a large feature with several distinct parts)
+
[[File:Git-commit-4.png]]
(piccy)
 
 
* When the commit is complete, press the "push" button to send your commit(s) to your github repository
 
* When the commit is complete, press the "push" button to send your commit(s) to your github repository
(piccy)
+
[[File:Git-commit-5.png]]
 
* Select your local branch name from the drop down list and ensure your Destination -> Remote: is "origin"
 
* Select your local branch name from the drop down list and ensure your Destination -> Remote: is "origin"
 
* If you want to, you can give the public remote branch a different name to your local branch (this can be useful when rebasing a branch already published to your public repository)
 
* If you want to, you can give the public remote branch a different name to your local branch (this can be useful when rebasing a branch already published to your public repository)
 
* Finally, press OK
 
* Finally, press OK
(piccy)
+
[[File:Git-commit-6.png]]
 
* Go to your Github Repository webpage and select the branch you just pushed
 
* Go to your Github Repository webpage and select the branch you just pushed
(piccy)
+
[[File:Git-commit-7.png]]
 
* When you have the correct branch selected, click on the "Pull/Review/Compare" button
 
* When you have the correct branch selected, click on the "Pull/Review/Compare" button
(piccy)
+
[[File:Git-commit-8.png]]
 
* Now click on "Create Pull Request"
 
* Now click on "Create Pull Request"
** Note: the previous three steps can be done as a single step if you have recently pushed a branch by selecting the "Compare and Pull Request" button
+
[[File:Git-commit-9.png]]
(piccy)
+
* Note: the previous three steps can be done as a single step if you have recently pushed a branch by selecting the "Compare and Pull Request" button
 +
 
 
* Add comments to the pull request if you wish, then click "Send Pull Request"
 
* Add comments to the pull request if you wish, then click "Send Pull Request"
(piccy)
+
[[File:Git-commit-10.png]]
 
* And that's it! Now you wait for the pull request to be reviewed and committed to primary FSO master branch
 
* And that's it! Now you wait for the pull request to be reviewed and committed to primary FSO master branch
 +
 +
== Simple Conflict Resolution: Tortoise Git ==
 +
 +
TBA

Revision as of 09:51, 24 February 2014

Getting the source: Tortoise Git

(based on Getting_the_FreeSpace2:_SCP_Source_Code)

  • Download and install Git For Windows (this is a degendency for TortoiseGit)
  • Download and install TortoiseGit (you probably need to reboot after installing)
  • Make a new folder on your HDD where you'd like to install the code. You'll need a fair bit of space for the code + the intermediate files when building it. Press right mouse and choose Git Clone from the list.

Git-clone-1.png

Git-clone-2.png

  • Press OK to begin downloading from the repository (this may take a few minutes, depending on the speed of your internet connection)


Simple Development: Tortoise Git

Note: the guide assumes that you will be developing using a github fork (which is recommended for everyone, SCP members and non-members alike)

Github-fork.png

  • Record the URL for your newly forked copy of the FSO repository

Github-fork-2.png

  • Get the code per the guide above (fix with proper intra-page link)
    • Note: you need to use the URL for your forked repository, not the main FSO repository listed above
  • Right click on the repository directory and select TortoiseGit -> Create Branch
    • Note: all development should be done in a new branch, instead of being done in the "master" branch. It's just simpler

Git-branch-1.png

  • In the new window, enter the name for the new branch, verify that the branch is based on HEAD (master) and check the "Switch to new branch" box

Git-branch-2.png

  • Write some code with your Editor of Choice
  • Test your new code
  • When you're happy with the code, right click on the repository directory and select TortoiseGit -> Diff

Git-commit-1.png

  • Review your changes by double-clicking on all the files listed in the new window (ensure no unwanted changes have snuck in!).

Git-commit-2.png

  • This is how the diff will be displayed (using TortoiseGitMerge, which is also used to resolve conflicts)

Git-commit-3.png

  • When your review is complete, press "Commit" (in the same window that you double clicked on all the changed files)
  • In the new window, add a commit message and press OK

Git-commit-4.png

  • When the commit is complete, press the "push" button to send your commit(s) to your github repository

Git-commit-5.png

  • Select your local branch name from the drop down list and ensure your Destination -> Remote: is "origin"
  • If you want to, you can give the public remote branch a different name to your local branch (this can be useful when rebasing a branch already published to your public repository)
  • Finally, press OK

Git-commit-6.png

  • Go to your Github Repository webpage and select the branch you just pushed

Git-commit-7.png

  • When you have the correct branch selected, click on the "Pull/Review/Compare" button

Git-commit-8.png

  • Now click on "Create Pull Request"

Git-commit-9.png

  • Note: the previous three steps can be done as a single step if you have recently pushed a branch by selecting the "Compare and Pull Request" button
  • Add comments to the pull request if you wish, then click "Send Pull Request"

Git-commit-10.png

  • And that's it! Now you wait for the pull request to be reviewed and committed to primary FSO master branch

Simple Conflict Resolution: Tortoise Git

TBA