Setting up git: Difference between revisions
imported>Errorage (1 revision) |
mNo edit summary |
||
(34 intermediate revisions by 14 users not shown) | |||
Line 1: | Line 1: | ||
This guide uses | This guide uses [https://tortoisegit.org/ TortoiseGit]. While there are other programs out there, this one is the most commonly used. This guide is for Windows only. | ||
Windows only | |||
More recent guides exist; here is a link to [https://forums.yogstation.net/index.php?threads/release-the-gitkraken-how-to-make-your-first-pull-request.15099/ Partheo's guide on the forums], which uses GitKraken and is aimed specifically at newbies who wish to contribute to Yogstation. There is also a [https://hackmd.io/@ZeWaka/goondev very modern guide by ZeWaka] from Goonstation that is adapted from that guide, and uses VSCode instead. Just make sure to change any reference from Goonstation to Yogstation instead! | |||
Alternatively, there are a few video talks on git that may be informative to a new or experience git user: | |||
- [https://www.youtube.com/watch?v=ZDR433b0HJY Introduction to Git with Scott Chacon of GitHub] (1:22:11) | |||
- [https://www.youtube.com/watch?v=MYP56QJpDr4 Git from BitsUp] (55:44) | |||
- [https://www.youtube.com/watch?v=4XpnKHJAok8 Tech Talk: Linus Torvalds on git] (1:10:14) | |||
==If you are having trouble== | |||
Watch this video guide if you are having difficulty with any step below. [http://www.youtube.com/watch?v=Z5tTCo6IHLg] | |||
If you have further problems, contact someone on [[Community|#coderbus]] | |||
== Step | ==Step 1 - Install Git== | ||
* Go here: http:// | *Go here: http://git-scm.com/downloads | ||
* Download the | *Download the Windows Git program. | ||
* | *It should look something like 'Git-1.7.11-preview20120620.exe' | ||
* | *Install it and leave everything on default (just keep clicking next). | ||
*Wait till the installer has finished. | |||
*Step 1 over! | |||
== Step | ==Step 2 - Register on Github== | ||
* Head over | *Head over here: https://github.com/ | ||
* Click | *Click '''Signup and Pricing''' in the top right-hand corner. | ||
* | *Click the ''Create free account button'''. | ||
* | *Create an account with your username and email. | ||
* | *Done! | ||
== Step | ==Step 3 - Configure Git== | ||
'''OPTIONAL!''' | |||
*Head here: https://help.github.com/articles/set-up-git/#setting-up-git | |||
*Follow the guide above from steps 2 to 4, you can install Git for Windows if you want however it's not recommended | |||
*Now you have Git all setup, but if you're command line illiterate like me, you'll wanna have some fancy graphics! | |||
==Step 4 - TortoiseGit== | |||
*Go here: http://code.google.com/p/tortoisegit/wiki/Download | |||
*Download the right TortoiseGit for your system. | |||
*When installing, click '''OpenSSH''' rather than TortoisePLink | |||
*Finish installing. | |||
==Step 5 - Forking Code== | |||
== Step 9 - Making a Branch == | *Head over to: https://github.com/yogstation13/Yogstation | ||
* '''Branching your repo is very important for organising your commits, you should have a different branch for each unrelated code change (e.g. if you wanted to make some new sprites for one item and change the properties of another these should be in seperate branches), as Pull requests work off branches rather than commits this will allow you to make a seperate Pull Request per change. Doing this streamlines the whole process and will save everyone a bunch of headaches.''' | *Click the '''Fork''' button in the top right corner. | ||
* Right-click in your working folder. Then choose '''TortoiseGit''', and '''Create Branch...''' | *The page you'll be directed to is now your fork. You'll be pushing updates here, and making pull requests to have them merged the main (master) repository. | ||
* Type in your new branch name | *Copy the HTTP URL. It's next to the '''HTTP''' '''GIT''' and '''Git Read-Only''' buttons. It'll look something like: https://github.com/NAME/Yogstation | ||
* (Optional) Tick '''Switch to new branch''' | |||
* Press '''Okay''' and your new branch is created | ==Step 6 - Downloading the Code== | ||
*Find a place you don't mind the code sitting. | |||
*Right click and choose '''Git Clone...''' | |||
*The URL field should be filled with the URL of your Fork. If not, paste it in. | |||
*Click Next and watch flying tortoises bring you your code. | |||
==Step 7 - Setting up TortoiseGit== | |||
*Right click '''on the folder that was created''' (usually called Yogstation-master), and go to '''TortoiseGit''' and then click on '''Settings'''. | |||
*Click on '''Remote''' under '''Git'''. | |||
*There should be one thing on the list of remotes, with the name: '''origin'''. | |||
*You're now adding the main repository as a source you can pull updates from. | |||
*In the '''Remote''' box type in '''upstream'''. | |||
*In the '''URL:''' box put: https://github.com/yogstation13/Yogstation.git | |||
*Click '''Add New/Save'''. | |||
*Click '''Ok'''. | |||
*Almost done! | |||
==Step 8 - Updating your Repo== | |||
*Updating your repo with the master should be done before trying anything. | |||
*Right-click the folder your repo is in and select '''TortoiseGit''' then '''Pull'''. | |||
*Click the radial button next to '''Remote''' and make sure '''upstream''' (or whatever you called it) is selected next to it. | |||
*The '''remote branch''' should be set to '''master'''. | |||
*Then click '''Ok'''. This will pull the latest changes from the master repo. | |||
==Step 9 - Making a Branch== | |||
*'''Branching your repo is very important for organising your commits, you should have a different branch for each unrelated code change (e.g. if you wanted to make some new sprites for one item and change the properties of another these should be in seperate branches), as Pull requests work off branches rather than commits this will allow you to make a seperate Pull Request per change. Doing this streamlines the whole process and will save everyone a bunch of headaches.''' | |||
*Right-click in your working folder. Then choose '''TortoiseGit''', and '''Create Branch...''' | |||
*Type in your new branch name | |||
*(Optional) Tick '''Switch to new branch''' | |||
*Press '''Okay''' and your new branch is created | |||
To switch between Branches: | To switch between Branches: | ||
== Step 10 - Making a Commit == | *Right-click in your working folder. Then choose '''TortoiseGit''', and '''Switch/Checkout...''' | ||
*Choose your Branch then press '''Okay''' | |||
==Step 10 - Making a Commit== | |||
*A commit is confirmed change of the files in your repo, it's how you make changes permanently to the files in your repo, so try not to commit without making sure it works (though subsequent commits can fix it). | |||
*As said before, you should use different branches to separate your commits/changes. Don't commit to master. It should be clean, so you can fall back on it if needed. | |||
*To make your commits, you need to edit the files using BYOND's inbuilt editing tools. When you're finished, right click the folder you're working with and choose '''Git Commit -> "[Your Branch Name]"''' (Example: Git Commit -> "My_First_Branch") | |||
*You can then select only the files you want to be committed by ticking or unticking them. You should also write a detailed commit summary, detailing what happened in that commit. | |||
*Click '''Ok''' and the commit will be committed to your local repo! | |||
==Step 11 - Making a Pull Request== | |||
*Right-click in your working folder. Then choose '''TortoiseGit''', and '''Push...''' | |||
*Set '''Local''' and '''Remote''' to the name of the branch you committed before. (e.g. My_First_Branch) | |||
*Under Destination, set Remote: to '''origin'''. | |||
*Click '''Ok'''. This'll upload your changes to your remote repo (the one on GitHub). | |||
*Head to your GitHub repo e.g https://github.com/NAME/Yogstation.git | |||
*Click '''Pull Request''' at the top right. | |||
*Fill out a summary and then create the pull request. | |||
*You're done! In many cases there will be issues pointed out by other contributors, unfortunate merge conflicts, and other things that will require you to revisit your pull request. | |||
*Optionally, view step 13 for a guide on cleaner commit logs, '''cleaner commits help maintainers review!''' | |||
==Step 12 - Checking Out Github PRs Locally (Optional)== | |||
*'''This is a must for maintainers who need to easily test other people's code!''' | |||
*Locate the section for your Github remote in the .git/config file. Note that it is hidden by default. It looks like this: | |||
:[remote "upstream"] | |||
::fetch = +refs/heads/*:refs/remotes/upstream/* | |||
::url = https://github.com/yogstation13/Yogstation.git | |||
*Now add the following line: | |||
::fetch = +refs/pull/*/head:refs/remotes/upstream/pr/* | |||
* | *Fetch from the upstream remote. | ||
* To | *To check out a particular pull request, use Switch/Checkout and select the branch from the drop-down list. | ||
== Step | ==Step 13 - Clean commits (Optional)== | ||
* | *'''This is a guide specifically for TortoiseGit, our recommended client''' | ||
* | *Your commit logs are filthy, full of one or two line commits that fix an error that makes you look bad, and the commit is called "Whoops" or "oops" | ||
* | *Navigate to your '''local version of the branch''' | ||
* | *Ensure it is up to date with the '''remote''' | ||
* | *Go to '''Show log''' | ||
* | *Select all the commits associated with this change or PR | ||
* | *Right click and choose '''Combine to one commit''' | ||
*This will open up the standard commit interface for TortoiseGit, with the commit logs of the selected commits merged together | |||
*Perform the normal routine for a commit | |||
*Go to '''push''' your branch to the '''remote branch''' | |||
*Ensure '''Force Overwrite Existing Branch (may discard changes)''' is selected to make sure the PR/Remote updates to contain just this squashed commit | |||
{{Contribution guides}} | {{Contribution guides}} | ||
[[Category: | [[Category:Game Resources]] | ||
[[Category:Guides]] |
Latest revision as of 13:02, 26 August 2020
This guide uses TortoiseGit. While there are other programs out there, this one is the most commonly used. This guide is for Windows only.
More recent guides exist; here is a link to Partheo's guide on the forums, which uses GitKraken and is aimed specifically at newbies who wish to contribute to Yogstation. There is also a very modern guide by ZeWaka from Goonstation that is adapted from that guide, and uses VSCode instead. Just make sure to change any reference from Goonstation to Yogstation instead!
Alternatively, there are a few video talks on git that may be informative to a new or experience git user:
- Introduction to Git with Scott Chacon of GitHub (1:22:11)
- Git from BitsUp (55:44)
- Tech Talk: Linus Torvalds on git (1:10:14)
If you are having trouble
Watch this video guide if you are having difficulty with any step below. [1] If you have further problems, contact someone on #coderbus
Step 1 - Install Git
- Go here: http://git-scm.com/downloads
- Download the Windows Git program.
- It should look something like 'Git-1.7.11-preview20120620.exe'
- Install it and leave everything on default (just keep clicking next).
- Wait till the installer has finished.
- Step 1 over!
Step 2 - Register on Github
- Head over here: https://github.com/
- Click Signup and Pricing in the top right-hand corner.
- Click the Create free account button'.
- Create an account with your username and email.
- Done!
Step 3 - Configure Git
OPTIONAL!
- Head here: https://help.github.com/articles/set-up-git/#setting-up-git
- Follow the guide above from steps 2 to 4, you can install Git for Windows if you want however it's not recommended
- Now you have Git all setup, but if you're command line illiterate like me, you'll wanna have some fancy graphics!
Step 4 - TortoiseGit
- Go here: http://code.google.com/p/tortoisegit/wiki/Download
- Download the right TortoiseGit for your system.
- When installing, click OpenSSH rather than TortoisePLink
- Finish installing.
Step 5 - Forking Code
- Head over to: https://github.com/yogstation13/Yogstation
- Click the Fork button in the top right corner.
- The page you'll be directed to is now your fork. You'll be pushing updates here, and making pull requests to have them merged the main (master) repository.
- Copy the HTTP URL. It's next to the HTTP GIT and Git Read-Only buttons. It'll look something like: https://github.com/NAME/Yogstation
Step 6 - Downloading the Code
- Find a place you don't mind the code sitting.
- Right click and choose Git Clone...
- The URL field should be filled with the URL of your Fork. If not, paste it in.
- Click Next and watch flying tortoises bring you your code.
Step 7 - Setting up TortoiseGit
- Right click on the folder that was created (usually called Yogstation-master), and go to TortoiseGit and then click on Settings.
- Click on Remote under Git.
- There should be one thing on the list of remotes, with the name: origin.
- You're now adding the main repository as a source you can pull updates from.
- In the Remote box type in upstream.
- In the URL: box put: https://github.com/yogstation13/Yogstation.git
- Click Add New/Save.
- Click Ok.
- Almost done!
Step 8 - Updating your Repo
- Updating your repo with the master should be done before trying anything.
- Right-click the folder your repo is in and select TortoiseGit then Pull.
- Click the radial button next to Remote and make sure upstream (or whatever you called it) is selected next to it.
- The remote branch should be set to master.
- Then click Ok. This will pull the latest changes from the master repo.
Step 9 - Making a Branch
- Branching your repo is very important for organising your commits, you should have a different branch for each unrelated code change (e.g. if you wanted to make some new sprites for one item and change the properties of another these should be in seperate branches), as Pull requests work off branches rather than commits this will allow you to make a seperate Pull Request per change. Doing this streamlines the whole process and will save everyone a bunch of headaches.
- Right-click in your working folder. Then choose TortoiseGit, and Create Branch...
- Type in your new branch name
- (Optional) Tick Switch to new branch
- Press Okay and your new branch is created
To switch between Branches:
- Right-click in your working folder. Then choose TortoiseGit, and Switch/Checkout...
- Choose your Branch then press Okay
Step 10 - Making a Commit
- A commit is confirmed change of the files in your repo, it's how you make changes permanently to the files in your repo, so try not to commit without making sure it works (though subsequent commits can fix it).
- As said before, you should use different branches to separate your commits/changes. Don't commit to master. It should be clean, so you can fall back on it if needed.
- To make your commits, you need to edit the files using BYOND's inbuilt editing tools. When you're finished, right click the folder you're working with and choose Git Commit -> "[Your Branch Name]" (Example: Git Commit -> "My_First_Branch")
- You can then select only the files you want to be committed by ticking or unticking them. You should also write a detailed commit summary, detailing what happened in that commit.
- Click Ok and the commit will be committed to your local repo!
Step 11 - Making a Pull Request
- Right-click in your working folder. Then choose TortoiseGit, and Push...
- Set Local and Remote to the name of the branch you committed before. (e.g. My_First_Branch)
- Under Destination, set Remote: to origin.
- Click Ok. This'll upload your changes to your remote repo (the one on GitHub).
- Head to your GitHub repo e.g https://github.com/NAME/Yogstation.git
- Click Pull Request at the top right.
- Fill out a summary and then create the pull request.
- You're done! In many cases there will be issues pointed out by other contributors, unfortunate merge conflicts, and other things that will require you to revisit your pull request.
- Optionally, view step 13 for a guide on cleaner commit logs, cleaner commits help maintainers review!
Step 12 - Checking Out Github PRs Locally (Optional)
- This is a must for maintainers who need to easily test other people's code!
- Locate the section for your Github remote in the .git/config file. Note that it is hidden by default. It looks like this:
- [remote "upstream"]
- fetch = +refs/heads/*:refs/remotes/upstream/*
- url = https://github.com/yogstation13/Yogstation.git
- Now add the following line:
- fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*
- Fetch from the upstream remote.
- To check out a particular pull request, use Switch/Checkout and select the branch from the drop-down list.
Step 13 - Clean commits (Optional)
- This is a guide specifically for TortoiseGit, our recommended client
- Your commit logs are filthy, full of one or two line commits that fix an error that makes you look bad, and the commit is called "Whoops" or "oops"
- Navigate to your local version of the branch
- Ensure it is up to date with the remote
- Go to Show log
- Select all the commits associated with this change or PR
- Right click and choose Combine to one commit
- This will open up the standard commit interface for TortoiseGit, with the commit logs of the selected commits merged together
- Perform the normal routine for a commit
- Go to push your branch to the remote branch
- Ensure Force Overwrite Existing Branch (may discard changes) is selected to make sure the PR/Remote updates to contain just this squashed commit
Contribution guides
| |
General | Hosting a server, Setting up git, Guide to GitKraken, Downloading the source code, Guide to contributing to the game, Reporting issues, Game resources category, Guide to changelogs |
Database (MySQL) | Setting up the database, MySQL |
Coding | Understanding SS13 code, SS13 for experienced programmers, Text Formatting |
Mapping | Guide to mapping, Room Structure, Map merger |
Spriting | Guide to spriting |
Wiki | Guide to contributing to the wiki, Wikicode, Styleguide |