Difference between revisions of "Github Setup"

From The Powder Toy
Jump to: navigation, search
(update repo url)
(More references to scons to remove)
 
Line 4: Line 4:
 
==== Download and Set Up the Programs ====
 
==== Download and Set Up the Programs ====
 
* Create an account at this site: [[https://github.com/]].
 
* Create an account at this site: [[https://github.com/]].
* Download and install [http://msysgit.github.io/ MSysGit]. Get the full installer one. This will install Git, and also Git Bash and Git GUI. If you followed the "Compiling for windows with SCons" guide you already have this.
+
* Download and install [http://msysgit.github.io/ MSysGit]. Get the full installer one. This will install Git, and also Git Bash and Git GUI.
 
* Download and install [http://www.syntevo.com/smartgit/index.html SmartGit]. This won't be used until later, so you can skip this until needed if you want.
 
* Download and install [http://www.syntevo.com/smartgit/index.html SmartGit]. This won't be used until later, so you can skip this until needed if you want.
 
* Set up SmartGit:
 
* Set up SmartGit:

Latest revision as of 05:47, 25 June 2021

If you need any extra help setting up git, or just need help fixing a problem with git, ask on development assistance section of the forums.

Doing these steps in order is highly recommended.

Download and Set Up the Programs

  • Create an account at this site: [[1]].
  • Download and install MSysGit. Get the full installer one. This will install Git, and also Git Bash and Git GUI.
  • Download and install SmartGit. This won't be used until later, so you can skip this until needed if you want.
  • Set up SmartGit:
  • Choose Non Commercial so you can get unlimited use.
  • Enter your github account information, it will generate an OAuth token.

Forking tpt

  • Go to [[2]] and click the "Fork" button. This will create a copy of The Powder Toy in your account.
  • Open SmartGit, and go to Repository > Clone.
  • Enter the repository URL (https://github.com/name/The-Powder-Toy) and click next
  • Choose the directory where you want to store the source files.
  • Congratulations! You now have an easy way to make changes to the code and upload it to GitHub.
  • To set the username and email inserted into each commit, you can go to Repository -> Settings -> Commit. You should probably set this just in case it decides to put the wrong information instead.

Pushing to Github

  • Pushing to Github makes it easy for people to read the source and find out what you have changed. You can also just give a link to the github instead of uploading the entire source yourself this way.
  • Make sure you have saved all your changes, then open SmartGit
  • Any files you may have changed should be listed as "Modified". Clicking a file will show you exactly what has changed.
  • Deselect any files by clicking the repository name on the left, then press "Commit" at the top.
  • List the things you have changed in the text box, and press "Commit".
  • Press "Push" at the top, and press "Push" again.
  • It will ask for your github username and password, put these in here
  • If you don't want to type this in every time you can use an ssh key, but since that is harder to set up it's not described here (ask on IRC?)

Keeping up to Date

  • In Smart Git, go to Remote > Add
  • Under URL or Path, type https://github.com/The-Powder-Toy/The-Powder-Toy, and name it whatever you want (like "origin")
  • After it's verified, you then have to wait for commits you want to be made to the official repo. Once this happens, you can continue with these steps
  • Click Pull, it's the one on the very left
  • Under "Fetch From", change it to origin (or whatever you called it). A warning message will appear saying you can only fetch changes, ignore this.
  • There is also an option to either merge or to rebase. It is suggested to use "Merge" but both will have the same effect, just rebase is a little cleaner.
  • After that, click Pull.

There may be merge conflicts. This will happen if you modified something (ex. added a new element), and then Simon modified the same thing (ex. added a different element), and it can't figure out what to use. You will have to solve these yourself. Around every conflict, there will be a "<<<<<<" your code "======" Simon's code ">>>>>>". You have to decide which one to use. Sometimes, you want both, you have to decide what to do to merge them best. Once you have solved every conflict in a file, right click it in smart git and click "Resolve". Then, "leave as is". Once you have resolved all the errors, you can push the merge commit, and your code and Simon's will be merged together.

  • If the merge went well, you can commit and push the changes.

Sending a Pull Request

  • It is recommended to ask on IRC before sending a pull request, because things like new elements will probably just be rejected. If you still want to send one, follow these steps.
  • Go to your Powder Toy repository page on GitHub and press "Pull Request" at the top.
  • Send the request to The-Powder-Toy and you should be done. Verify that the code has been changed if you like.
  • If Simon decides to accept your request, your code will be in the official Powder Toy source code. Congratulations!