Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git Guide for the Gitless; A guide to using the git command line to make your life easier. #1171

Open
Ragunaga opened this issue Oct 5, 2015 · 1 comment

Comments

@Ragunaga
Copy link
Contributor

Ragunaga commented Oct 5, 2015

(Any instructions in this guide denoted between quotation marks does not include the quotation marks, unless inside another pair of quotation marks.)

Recently there have been a few people with questions about git, or having problems with editing large files on the website. I made this guide to help address some of those questions and problems, as well as to get everyone that is helping translate to use git.

Git makes life so much easier for you, not only does it allow you to actually utilize Real Time Translation (RTT) in a way that is not cumbersome, but it also makes previously un-edit-able files (such as quest_200) edit-able.

So, to start out you'll need two things. The git command line, and an actual text editor that isn't notepad.

You can get git commandline for windows here; https://git-scm.com/download/win

You can get an actual text editor (notepad++) here; https://notepad-plus-plus.org/repository/6.x/6.8.3/npp.6.8.3.Installer.exe

Now that you got those downloaded, you should know it may look hard at the start but it really is an easy piece of software to navigate. The hardest part is setting everything up the first time, and to help with that I will include a step by step guide below.

Step-by-Step Guide to Setting Up

So first thing first, you need to know where your install of Tree of Savior (ToS) is. Generally if you did everything by default it'll be in the location "C:/Nexon/TreeOfSavior/".

Once you find out where it is, open up the git command line. The git command line is your general run of the mill command line, if you've ever seen window's command prompt it's basically the same exact thing as that. You enter commands with the keyboard, hit enter, and it'll do whatever you told it to. Or throw up an error. It likes to throw up errors occasionally.

Now, to start out git is going to always open up with it's default path selected. That means it'll always be set so that it thinks "C:/blahblah is the repository you're working on everytime you open it.

To fix this you're going to have to enter this command, and a similiar command every time after you set up, to get it to point to the right folder/repository.

"cd " In most cases, filepath will be replaced with "C:/Nexon/TreeOfSavior/release/languageData/"

What that command does is it sets the current repository you're working in. In this case we're setting it as the language folder for ToS, so you can easily read and edit the files ingame.

We aren't quite done yet, we need to go one more layer deeper. Now we need to make a folder inside this folder, and set that as our repository.
This folder will be an exact copy of the current files in your github.

"git clone " For me this would be
"git clone https://github.com/Ragunaga/EnglishTranslation"

That'll create a new folder in the current repository (Named EnglishTranslation), and then you need to switch over to the new folder using the cd command. Now we should go ahead and make sure it's updated.

To do this, we have to do a few more commands to set up what is called a "remote" or "upstream". Basically a fancy word for online repository, the ones you've been using until now.

"git remote add " Is the command we will use. In this case that should be; "git remote add imcgames https://github.com/Treeofsavior/EnglishTranslation.git"

This creates a new remote/upstream named imcgames, and the repository it named is the link (with .git at the end.)

Now that we've added a remote, we can fetch information from it, and use it to update our local repository. Whenever you're using a remote/upstream you'll have to fetch it first. That pulls all the information from online so it's ready for use.

"git fetch " AKA; "git fetch imcgames"

Now with the data locally obtained, we can try and merge it with the clone of your repository you made earlier.

"git merge / "
Ok, this can be a bit confusing. After seeing the example, it'll hopefully clean it up for you tho.
"git merge imcgames/master master"

What that does it take the branch "master" from "imcgames" and merge it into your local repositories master branch. Say you had made another branch, which I'll explain how to do later, and wanted to merge into it. You'd use "git merge imcgames/master ragunaga-1" for example.

Now that you've got an uptodate master, and I'll detail later how to keep it up to date, we should create a branch for you to work off of. This is acomplished by the simple command;

"git branch "

That'll create a new branch named whatever, and switch to it.
"git branch" will just list all the current branches you have.

To switch to a specific branch you'd use the command;

"git checkout "

Simple as that, you'll now be on that branch.

You are completely set up for editing files now! Continue reading for more information on how to push your changes back online, and other handy things.


Making Your Changes

Say you've edited the file ITEM.tsv using RTT. (By the way, you need to have your ingame language set to "EnglishTranslation". Not "English".)

You want to push that changed file to your online github, so you can make the pull request.
This process is much easier then setting up, so don't worry.

Now, when you first open git command line, it'll always be on that default repository, so you'll have to change it using "cd " like before. This time however, you'd include "EnglishTranslation" at the end of the line, like this.

"cd C:/Nexon/TreeOfSavior/release/languageData/EnglishTranslation"

You'll have to do this everytime you open up the command line.

Now, you may notice that it opened up this repository on the same branch you left it off of. This is a nice little thing, but be sure to always double check you're on the right branch before messing with stuff, or closing the command line.

So, back to the changes you made.
If you do;
"git status"
You may notice that ITEM.tsv is in red, that's because you've modified it but not confirmed with git that you want those changes finalized.

To finalize the changes you have to do
"git add " in this case "git add ITEM.tsv"
(You can also add multiple at once, such as "git add ITEM.tsv QUEST.tsv")

Now if you do "git status" it should be green, meaning it's finalized.

Next you should give your changes a handy commit,

"git commit -m """

This creates a commit with whatever message you want, and the message has to be enclosed in quotations.

Now with your commit made you can simple do;

"git push origin "

Origin is a special little upstream/remote that was automatically made when you cloned the repo, all you have to do here is specify which branch you want to update on your online github, and you're ready to go. For example, "git push origin ragunaga-1".

After you do that you can go online and make the pull request as intended. Be warned, I recommend making any additional changes after you push something through on the website. Do all the work locally from here on out, so you can avoid messing with the command "git pull". Incase you have to for some reason, you can keep reading as I will explain git pull later on.

Now you're all done making your change~ There are a few things that can crop up while doing these steps, so read on further for fixes and more commands to help.


To Be Continued.

@laurencee
Copy link
Contributor

Probably easier for most people to use SourceTree, it has a pretty good GUI for new people to git and is much easier to see what changes have taken place.
Here's a guide for people who would prefer to use a GUI tool to assist them.

  1. On github fork the repository (must be logged in) by clicking the fork button in the top right
    image
  2. In SourceTree clone the fork using the https url provided on your fork page. (TIP: you can clone this into a folder under "TreeOfSavior\release\languageData" so that you can switch to that language in game, it will be show up in game as the same name as whatever folder you clone into)
    image
    image
  3. Add the official repository a new remote in SourceTree (Repository -> Add Remote)
    This is where you will pull the most up to date version of the data from the IMC repository
    image
  4. Before starting on new changes, create a new branch for each set of changes.
  5. To keep your repository up to date, pull from "upstream" into your local master branch.
    If you have existing changes, tick rebase so that your changes will be put after any existing changes (this makes it easier to read pull requests).
    image
    image
  6. When your changes are ready to be sent to IMC, push your changes back to your fork:
    image
  7. On the github page your fork will display as "X commits ahead of ...", now you can click the pull request link that's listed just above the files and follow the prompts to submit your changes for review and eventual merging by IMC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants