1 (edited by GreYFoX 2011-02-13 20:48:17)

Topic: [DEVELOPMENT] How to make a clean pull request on github or any git

Introduction
First you need some git knowledge search online for some tutorials for basic info.

now before you start editing you need to have a clean working dir.

if you don't have a clean working dir here is how to clean it up and keep the current changes

git stash save 

this will save you changes later you can do

git stash pop 

how to clean it up and lose the changes

git reset --hard

now to start making changes cleanly to make a pull request with it you need to have the latest changes from the main teeworlds repo https://github.com/teeworlds/teeworlds

I am assuming you have a teeworlds repo already cloned.

Note For the Windows GUI stash or Reset Stuff you can look to the bottom of the guide

All OSes Command Line
Do this:

1- git remote add oy git://github.com/teeworlds/teeworlds.git
2- git fetch oy
3- git checkout -b oypullrequest1 oy/master
4- do what ever changes you want
5*- git commit -a -m"Example commit message"
6- git push origin oypullrequest1 
7- make a pull request from yourrepo:oypullrequest1 to oy'srepo:master
7- details in the end of the post

this way you will have a clean pull request

*p.s. step 5 may not be the best way to commit if you have your .gitignore messed up, please consult other online guides on how to commit the best way that suites you.
ALSO: this is VERY IMPORTANT make your commit message something relevant to what you did and make it professional so that the puller of this commit will not be ashamed to pull it in his repo

Last Steps works for all operating systems on all usable git versions.

Windows GUI (Tortoise git)
the next is for windows Tortoise git, i will assume u read all of the above.


Step 1 - add remote
http://img8.imageshack.us/img8/7497/15322486.th.png

http://img269.imageshack.us/img269/218/addremote.png

Step 2 - Fetch

http://img683.imageshack.us/img683/2702/fetcho.png

then choose oy or the remote you just created then ok
Step 3 - creating a branch

http://img193.imageshack.us/img193/9584/73551391.th.png

http://img96.imageshack.us/img96/1740/57183307.png

Step 4 - do what ever changes you want
Step 5 - commit
VERY IMPORTANT make your commit message something relevant to what you did and make it professional so that the puller of this commit will not be ashamed to pull it in his repo
http://img27.imageshack.us/img27/889/38096234.th.png

http://img141.imageshack.us/img141/8740/67413765.th.png

Step 6 - push

http://img8.imageshack.us/img8/7497/15322486.th.png

http://img684.imageshack.us/img684/5879/77418250.th.png

Step 7 - do a pull request on github
details in the end of the post

P.S.
if you need The stash stuff or git reset here is how to do it.

Stash
http://img831.imageshack.us/img831/9682/stashr.th.png
1- saves your current changes
2- applies the latest saved stash but doesn't delete it ( i am not sure )
3- applies the latest saved stash and deletes it
4- shows all stashes

Git Reset
to do git reset you need to use
http://img156.imageshack.us/img156/2268/showlog.png
then right click the commit you want to reset to
and then choose
http://img37.imageshack.us/img37/1221/resetz.th.png


Step 7 In details

in your repo screen click pull request
http://img24.imageshack.us/img24/139/repo.th.png

you will probably get a destination branch that you don't want and a source branch that you don't want
so click change commits
http://img714.imageshack.us/img714/4186/defaultpull.th.png

change the left drop down to the target person's repo and type in the branch name
change the branch name on the right to oypullrequest1 or what ever u named it
from
http://img840.imageshack.us/img840/8340/defaultcommitrange.th.png
to
http://img10.imageshack.us/img10/7555/updatecommitrange.th.png

OR

you can choose some commits instead of all commit differences inside a branch:
see this branch here has 3 commits
http://img203.imageshack.us/img203/5248/whereyp.th.png
if i wanted to choose the 1st commit only
would paste 34731674 instead of FreezeTest on the right in this picture:
http://img840.imageshack.us/img840/9434/branchy.th.png

or 57e53092 for the 1st 2 commits
Note: 57e53092  or 34731674  are commit hashes that can be found in the commits diff page

http://img203.imageshack.us/img203/5248/whereyp.th.png

after filling and checking the branch names
http://img59.imageshack.us/img59/6696/finaliz.th.png
click send pulll request

if you are looking for support for DDRace, please go to http://DDRace.info.

2 (edited by Dune 2011-02-11 17:07:19)

Re: [DEVELOPMENT] How to make a clean pull request on github or any git

Thank you a lot for that, it's short, clean, but sooo useful! smile

Edit: What's up with the emotes? I miss the old ones sad

Not Luck, Just Magic.

3 (edited by GreYFoX 2011-02-12 00:53:31)

Re: [DEVELOPMENT] How to make a clean pull request on github or any git

FAQ Windows GUI:
Q:
if i do stash save this info pops :
stash success
no local changes to save
A:
then your working directory was clean, didn't need stashing

Q:
i cant make step 2-4
A:
some options needs to be put in the context menu from the settings, alternatively you can hold shift everytime you right click.
Also not that i have my settings to put all the commands i need in the main context menu, when this is done the text is Git OPTIONNAME, when it's not active u'll find it as OPTIONNAME only
Example Instead of Git Fetch you will find Fetch

FAQ Command Line:
Q:
Why are there no questions here?
A:
Cause no body who uses command line asked me yet.




Added Windows Stuff, my gift to you guys since Mubarak left today ^^

if you are looking for support for DDRace, please go to http://DDRace.info.

4 (edited by ghost 2011-02-13 15:30:45)

Re: [DEVELOPMENT] How to make a clean pull request on github or any git

GreYFoX wrote:
3- git branch -b oypullrequest1 oy/master

I believe the correct way to do this would be

git checkout -b oypullrequest1 oy/master

This will result in the desired behaviour. The -b parameter is not even available for git branch.

5

Re: [DEVELOPMENT] How to make a clean pull request on github or any git

Thanks a lot, i am beginner with "git" and i had need of your guide, thanks again,
before your guide, i had delete and re-fork everytime my repository <--- i was in a very noob style!
now i can remain up-to-date with oy, and make a clean pull request without delete & re-fork continuously,
but i not use tortoise, i have installed the standars git (Bash & GUI),
at 3° step- (git branch -b oypullrequest1 oy/master) result unknown parameter "-b"
and i replace it with parameter "-t", i thought "-b" was for "track" option, because i saw Tortoise windows image,
I was wrong?

6

Re: [DEVELOPMENT] How to make a clean pull request on github or any git

ghost91 wrote:
GreYFoX wrote:
3- git branch -b oypullrequest1 oy/master

I believe the correct way to do this would be

git checkout -b oypullrequest1 oy/master

This will result in the desired behaviour. The -b parameter is not even available for git branch.

i just got and error and found out while telling a friend and changed it, thanks smile

if you are looking for support for DDRace, please go to http://DDRace.info.

7 (edited by Trust.Allisone 2011-03-06 09:32:15)

Re: [DEVELOPMENT] How to make a clean pull request on github or any git

What if step 4 takes 2 weeks and 20 new commits have been made in that time in the master that I cloned and started to modify.

I know I could commit and make the pull request nevertheless. But is there a more gentle way that an advanced git user would choose so for the author of master the merge of my comitted pullrequest is easier in the end ?

8

Re: [DEVELOPMENT] How to make a clean pull request on github or any git

@Trust: i just saw this, sry for the late reply:

this is the cleanest way to make a pull request but i will tell you what can make it easier to merge:
1- When adding new Functions add it to the end of the file
2- when adding new code, possible make a function for it at the and of the file and call it.
3- when having to edit in the middle of the file, keep the code around your code unchanged so that merging can be somewhat easy.
4- add comments to describe what your code does

if i remember anything else i will let you know

if you are looking for support for DDRace, please go to http://DDRace.info.

9

Re: [DEVELOPMENT] How to make a clean pull request on github or any git

Hey there
I'm a beginner and the forums and Git. This topic helped me but I may need to ask a few questions in the future. I just need time to get used to it.

Happier than ever smile
Visit my YT channel. Spammy link removed // heinrich5991

10

Re: [DEVELOPMENT] How to make a clean pull request on github or any git

@twistedfate: pm me