• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Contributing to someones repository/create a pull request on Github.

dominique120

Science & Reason
Senator
Premium User
Joined
Jun 16, 2013
Messages
3,881
Solutions
3
Reaction score
1,043
Location
Númenor
Hello everyone. Today I'm going to make a tutorial on contributing to someones repository on Github. Since many people are now using it (and many have no idea how to use it) this tutorial will help you.
First go to github.com and create an account:
RiRxzd0.png


Lets get our tools now:

  • On windows you can get the get the github client for windows here
  • On Debian/Ubuntu you can do "apt-get install -y git"
  • On Fedora you can do "yum install -y git"
  • On a Mac you can get the git-scm tool from here
Now you must configure git to use your new account. Since there are many platforms that you can use I will not cover this step. Look at this tutorial for configuring git (Its a one time thing only)
Now lets go to a repository we would like to contribute to like this one by @Printer. Now look at the top and press the fork button
EoQMTSg.png

It will process for a bit the it will be ready.

  • Now open a terminal. In Linux/Mac/Cygwin you can just open up a terminal and work with git as long as you installed it properly.
  • On Windows open the Git Shell:
    6snSa9U.png
Now we are ready to work:

Type:
Code:
git clone https://github.com/"your username"/FORGOTTENSERVER-ORTS

Before we continue lets go into the folder we cloned:
Code:
cd FORGOTTENSERVER-ORTS

Now you have a copy of the repo you forked. Lets create a link between our fork and the one we want to contribute to with this command:
Code:
git remote add PrinterLUA git://github.com/PrinterLUA/FORGOTTENSERVER-ORTS.git

Now go to wherever you saved the repository you want to contribute to and do all the changes you planned.
You can see whats been changes and what as not been added bu using the command:
Code:
git status
It will print out something like this if you are on a windows machine:

dFXhwZf.png

When you are finished you are ready to upload or "commit" your changes, this is how to do it:
Type:
Code:
git commit -a
The default text editor will open up. Add some notes here to tell other users what you have done.

nAJjnD3.png

Save the document (CTRL +S), close notepad and go back to the terminal

Now to make your changes affect the fork on Github you must execute this:
Code:
git push


Now we are ready to make a pull request. Go to your forked repository on Github. See that we successfully pushed our commit/s
aUJAk4w.png


Now go to the original repository and find this green button:

nkuv6Jn.png


Press "compare across forks"
UVdSFLP.png

and find your fork:
jhW9nGT.png

Now press that big "Create a Pull Request" button
Tf1RyZP.png


Now write a small comment to describe the changes in this pull request:
ZhspQFC.png


Once its done send it!

Your pull request will remain
A3AYdKh.png
till the owner or a contributor accepts it. Once its accepted it will be
0wpBlVk.png
. You will also get an email depending on your Github settings.

And thats it! You have successfully contributed to making a project better.

Credits to @Printer for letting me use his repo so many times :p
 
Last edited:
when I try to execute:
Code:
git remote add PrinterLUA git://github.com/PrinterLUA/FORGOTTENSERVER-ORTS.git

it says
Code:
C:\Users\Puncker\Documents\GitHub> git remote add PrinterLUA git://github.com/Pr
interLUA/FORGOTTENSERVER-ORTS
fatal: Not a git repository (or any of the parent directories): .git
C:\Users\Puncker\Documents\GitHub>

I've done everything like you said on the tutorial (just changed the dominique120 into my username, even if you didn't tell us to change it lol) and got stuck at this part, help me please? :D @dominique120
 
@Evil Puncker First cd into the folder of the repository. In this case "cd FORGOTTENSERVER-ORTS", then execute the command

and I'll update the tutorial :p
 
@Evil Puncker First cd into the folder of the repository. In this case "cd FORGOTTENSERVER-ORTS", then execute the command

and I'll update the tutorial :p
thanks :) what about that part:
Code:
git clone https://github.com/dominique120/FORGOTTENSERVER-ORTS

update the tutorial and tell user to change your username into his username :p

@edit
Thanks, I've just made my first pull request =) the only weird thing is that if I use notepad++ as default txt editor I can't use git commit -a since once it opens the txt file the console says that it is empty already (seems like notepadd++ autosaves it) so I need to go and change default txt editor to notepad lol :/ but okay
 
Last edited by a moderator:
hey @dominique120 is the step:

Code:
git remote add PrinterLUA git://github.com/PrinterLUA/FORGOTTENSERVER-ORTS.git

really necessary? I'm asking that because I've forgot to do it one time and everything went well even missing that part
 
hey @dominique120 is the step:

Code:
git remote add PrinterLUA git://github.com/PrinterLUA/FORGOTTENSERVER-ORTS.git

really necessary? I'm asking that because I've forgot to do it one time and everything went well even missing that part

That necessary when you do everything from the console(without github). I left it just in case some people run into problems.
 
So every time i wand to contribute something i need to fork on github? Because the main repository always get new updates/commits, so my old fork is not up to date, which means i need to delete the old fork on github and do a new fork and work on the new fork.
 
So every time i wand to contribute something i need to fork on github? Because the main repository always get new updates/commits, so my old fork is not up to date, which means i need to delete the old fork on github and do a new fork and work on the new fork.

I always like to delete old forks to work with the latest code but most of the times you can use old forks.
 
its only necessary to update if the files that you were/are working at got changed
 
Back
Top