MegaGlest Forum

Modding and game content creation => Tools => Topic started by: titi_son on 23 July 2014, 19:52:32

Title: How to setup a fork on github for develop
Post by: titi_son on 23 July 2014, 19:52:32
I really have problems to manage git. Because I would like to develop simple features like the HP-Bar i died i would like to set up myself a fork to develop.
The problem is that i dont understand how?  :confused: Maybe i have a completely wrong understanding of git.

FreshD helped me, but i dont think its working porperly.

So could you please give me a step by step instruction how to set it up and answer to the following questions:
1. Should i better have 2 folders on my pc? One for the original mg-repo and one for mine?
2. How can i setup this remote stuff?
2.1 How do i update my branches in my fork repo? Or shouldnt I?
2.2 Which steps do i need to take to update/to get the newest version?
Code: [Select]
git checkout upstream/develop
git pull
?
2.3 Maybe you could even explain me the stuff with the remotes because i dont get it in any way yet :(
3. How can i let a branch be based on the the newest develop branch from the mg-repo and how can i push it to my repo? Or is creating new branches in my repo the wrong way to do it?
4. When i write git push on a branch which is not in my "online"-repo it will be created right?
5. How do i switch the branches correctly? With git checkout branchname?

OR

Tell me another way to set up something to develop.

Its really sad that i dont get the idea of git, because git is the only thing that prevents me from developing for mg (ok i am a newbie in c++ but i can implement simple features). The last week i really tried to make some things, but most of the time was wasted into understanding git. I think i wasted about 5 hours or more into understanding git and this is definitely to much for a version control system.  >:(
Is it really this hard to contribute to mg???

EDIT: I got it working now and i think i got it but a small instruction to look up if i did everything right would be nice!
Title: Re: How to setup a fork on github for develop
Post by: FreshDumbledore on 23 July 2014, 20:26:34
Well, as i just destroyed my local clone (at least i thought so, actually i think now it was fine and i just cause an error myself lol) and re-did it (in less than 2 minutes :P) here is exactly what i did:

$ rm -rf megaglest-source/
$ git clone https://github.com/FreshDumbledore/megaglest-source // clone your own fork-rep
$ cd megaglest-source/
$ git pull // can be ignored, just to show we got all data with the clone command
Already up-to-date.
$ git remote add upstream https://github.com/MegaGlest/megaglest-source // add the official mg repo as your upstream to fetch from
$ git fetch upstream // fetch from the original repo (not your clone) to be up to date with it
$ git checkout develop // can be ignored we were already on develop
Already on 'develop'
$ git pull
Already up-to-date.

What is, by the way, exactly what the instruction i linked you tells to https://help.github.com/articles/fork-a-repo

mine is working again :-P
Title: Re: How to setup a fork on github for develop
Post by: titi_son on 23 July 2014, 20:29:22
And now the develop branch has upstream/develop as base and origin/develop as target?
Or do i need to update my local develop branch somehow?
Title: Re: How to setup a fork on github for develop
Post by: FreshDumbledore on 23 July 2014, 20:38:37
one more thing i needed to do:
[branch "develop"]
        remote = upstream
        merge = refs/heads/develop

adjusted the remote name in the .git/config
theres a better way to do that but i know this one and it works :D
Title: Re: How to setup a fork on github for develop
Post by: Omega on 25 July 2014, 04:38:09
theres a better way to do that but i know this one and it works :D
git push -u origin develop. If I recall correctly, if you try and push without setting the remote branch to push to, you should get a message that details the command to use(this one).