Jump to content

Recommended Posts

Posted

I'm sorry, but I'm getting even more confused. The thing here is that you can't compare command names (and anything else) with SVN, so checkout is something little different, revert as well, ...

The simpliest example (using your local master branch for your development) would be like

git clone <url here>
cd mangos/
<set up your name+email using git-config>
<make some changes>
git add .
git commit
<see what was changed, errors, typos, ..> git diff HEAD^
<make some other changes>
git add .
git commit
<now you want to push them>
git push origin

Since you're using only one branch all the time, your changes remain in your working tree all the time.

To get out of confusion, you might want to read some manuals (which is more important than anything) ..

You may read some of my articles here in http://getmangos.eu/community/viewforum.php?id=27 (chapter 1-4) so you can get the basic idea of remotes and some links on manpages/user manuals/other articles .. :)

PS: I don't know what OS do you use, but git came from the *nix world where things often work after reading some docs and manpages, so don't be lazy and read some, it will help you more than asking here for a specific question and realizing some other problem when you want to do something similar later.

  • 38 years later...
Posted

I'm sorry!!! hehe

Anyway, I need a hand here. Pretty please? :D

Alright. Let's start with the obvious. I didn't follow any tutorials from here. I read GitHub's help files and one particular tutorial I found on the some corporate site which had a nice layout and explanations... Next time I'll know... Well, it might just be me too! Most probably is. LoL

So... I forked mangos/mangos and got a nice MadJack/mangos, which is good.

I make some changes and commit them to my branch after going through hoops and limboing across "git this here there"; but my commit ended up in a BRANCH of my fork...

I succeeded to merge the mangos/mangos with madjack/mangos but MY changes are not in MY tree! :( It's in a branch of my tree... LoL

What I'd like to do is have my fork, make my changes, commit them and merge the mangos/mangos to my tree. Pretty easy I think... :)

OTOH, it might be working as intended, but I suspect I made a mistake along the way.

Help very appreciated! :D

Thanks.

Posted

You probably missed the fact that your fork on github is just your remote repository. All your commits goes to your local repo on your HDD. You probably need to push changes (commits<-trees<-blobs) to the remote ....

Try creating a temporary repository on github, it should give you instructions after it's creation (those are the same as for fork).

Posted

I suggest you to read http://eagain.net/articles/git-for-computer-scientists/ so we'd know what exactly do you mean. I can't guess what you mean by "tree", if it's a tree object pointed to some commit, or just a "working tree", branch is nothing more than a "pointer" to a commit (in Git), so your expression doesn't make sense for me.

btw .. try that thing with registering a new repo, there's a short step-by-step guide IIRC

Posted

http://github.com/mangos/mangos/tree/master <-- MaNGOS TREE

http://github.com/MadJack/mangos/tree/master <--- This is MY TREE

In mangos/mangos, you have one BRANCH. (303-willcrashforsure and master of course)

The BRANCH above is reflected in my tree. That's fine and normal.

Now, as I was saying, I committed my changes, THEN pushed them. From what I understand, my tree should reflect those changes but they are not.

My problem is that all those changes I made are in that branch of my tree (http://github.com/MadJack/mangos/tree/madjack) and not in the "base tree", for lack of a better word...

Before anyone asks, yes, I am sure I pushed those changes. Before I pushed them, they were not in my branch so I guess I made a typo or something along the way or, again as I asked earlier, maybe that's the way it works in the first place.

Btw, stop the patronizing... It's not helpful.

Posted

I dont understand, you pushed commit 8d0dcecc1ff50b5d8b16cda0ef82d893bc81a060 "Added loading a custom script dll simple routine" and it is in your branch "madjack", it's in your tree, what's missing ?

did you expect your push to be in your "master" branch ?

Posted
http://github.com/mangos/mangos/tree/master <-- MaNGOS TREE

http://github.com/MadJack/mangos/tree/master <--- This is MY TREE

In mangos/mangos, you have one BRANCH. (303-willcrashforsure and master of course)

The BRANCH above is reflected in my tree. That's fine and normal.

Now, as I was saying, I committed my changes, THEN pushed them. From what I understand, my tree should reflect those changes but they are not.

My problem is that all those changes I made are in that branch of my tree (http://github.com/MadJack/mangos/tree/madjack) and not in the "base tree", for lack of a better word...

Before anyone asks, yes, I am sure I pushed those changes. Before I pushed them, they were not in my branch so I guess I made a typo or something along the way or, again as I asked earlier, maybe that's the way it works in the first place.

So you need to "checkout" a branch (which is a ref to some commit, which has a tree depending on it) to your WORKING TREE (filesystem), right? Then use "git checkout <branchname>".

Btw, stop the patronizing... It's not helpful.

It was not meant this way. Just wanted to give you a link with some information on that, so I could understand your problem. If you don't want my help, just say it.

Maybe the problem was in no smileys as the post might look like that :)

btw: The mangos repository has two branches - master and 303-willcrashforsure ... and, as jolan said, you can't expect your changes to "travel" from your own branch to the master one, because master isn't some "main" branch, it's *just* an ordinary branch like any other.

edit:

Before anyone asks, yes, I am sure I pushed those changes. Before I pushed them, they were not in my branch so I guess I made a typo or something along the way or, again as I asked earlier, maybe that's the way it works in the first place..

It can work like that. You need to understand that branches ale like isolated trees (in your terminology), when you make changes in one branch and checkout to the other one, you can't expect your changes there (if you made a commit). It is possible to push branch that you're not "on" - "git push remotename src_branch:Dst_branch", but no idea if it's related to your problem.

Posted
I dont understand, you pushed commit 8d0dcecc1ff50b5d8b16cda0ef82d893bc81a060 "Added loading a custom script dll simple routine" and it is in your branch "madjack", it's in your tree, what's missing ?

did you expect your push to be in your "master" branch ?

Yes jolan, that's exactly what I expected: my trunk/tree to reflect the changes I committed and pushed (and the merges I would eventually do with mangos's main tree)

Let me take an example. If Vladimir makes an update and a commit, it is on mangos/mangos tree. Why isn't mine in my tree? Why is it only in that branch of mine, which incidentally, I never wanted in the first place.

So you need to "checkout" a branch (which is a ref to some commit, which has a tree depending on it) to your WORKING TREE (filesystem), right? Then use "git checkout <branchname>".

My understanding is that when you do a checkout, it simply downloads the checked-out tree/branch locally... I'm confused now...

It was not meant this way. Just wanted to give you a link with some information on that, so I could understand your problem. If you don't want my help, just say it.

Maybe the problem was in no smileys as the post might look like that :)

All forgiven. Don't worry. :)

btw: The mangos repository has two branches - master and 303-willcrashforsure ... and, as jolan said, you can't expect your changes to "travel" from your own branch to the master one, because master isn't some "main" branch, it's *just* an ordinary branch like any other.

AFAIK only Vladimir or one of the other assigned persons on mangos/mangos can commit others changes to that tree and that's not what I expected from my commit/push.

edit:

It can work like that. You need to understand that branches ale like isolated trees (in your terminology), when you make changes in one branch and checkout to the other one, you can't expect your changes there (if you made a commit). It is possible to push branch that you're not "on" - "git push remotename src_branch:Dst_branch", but no idea if it's related to your problem.

I don't want my changes to be in mangos/mangos, only in madjack/mangos... So, if I follow your instruction above:

git push madjack mangos:madjack

or

git push madjack/mangos madjack:madjack ?

LoL

Sorry if I sound thick here but this is confusing the hell outta me!

Posted

The above worked nice. Thanks.

But before I had it working I decided to start with a clean slate and deleted the whole content of my local mangos directory.

I was able to clone and download my forked branch (from mangos/mangos), made the changes again (I backed up World.cpp), committed them and finally pushed them. All is good and is reflected where I want it to be (ie: MadJack/mangos).

But... (You knew that was coming right? ;)) My problem now is that, for some reason, when I try to "Git pull/merge/fetch" from mangos/mangos, it doesn't want to (so I can have the latest commits).

MaNGOS is defined as:

[remote "mangos"]

url = git://github.com/mangos/master.git

fetch = +refs/heads/*:refs/remotes/upstream/*

So when I try: "Git merge mangos" I get: fatal: 'mangos' does not point to a commit...

PS: I'm on Vista but I use Git Bash. I've used *nix before and I've been with computers most of my life... ;) I have read a lot of stuff on Git but it's a learning process and some things are still blurred in my mind.

Posted

Finally got it to work as I wanted! :)

I did a lot of "mistake" in interpreting what I thought something was doing and its actual purpose... Anyway, all changes are now reflected in my fork'ed src of mangos and the main commits made by the team is also there. That way I can use my changes and still get the updates without suffering with a cut/paste syndrome ;)

Thank you freghar2 :)

Wanted to add stuff that I learned along the many reads I've done...

So after I have done my changes (in this example I had committed and pushed them before getting the main dev's commits) I did this:

git checkout master <---- Which essentially means: USE master

git pull git://github.com/mangos/mangos.git master <--- which means: get the changes FROM there and merge it THERE (master)

git add . <--- add everything that has changed starting in this directory (changes from the previous step)

git commit -a <--- commit ALL changes (locally)

git push <--- send to origin (remotely to your forked version)

Is that a good interpretation of how this works?

Posted
So after I have done my changes (in this example I had committed and pushed them before getting the main dev's commits) I did this:

git checkout master <---- Which essentially means: USE master

git pull git://github.com/mangos/mangos.git master <--- which means: get the changes FROM there and merge it THERE (master)

git add . <--- add everything that has changed starting in this directory (changes from the previous step)

git commit -a <--- commit ALL changes (locally)

git push <--- send to origin (remotely to your forked version)

Is that a good interpretation of how this works?

Pretty fine, I won't go into details :)

.. just note that "git pull <URL> <branch>" means "branch" of that remote repository, not local.

Good luck!

Freghar

Posted
Pretty fine, I won't go into details :)

.. just note that "git pull <URL> <branch>" means "branch" of that remote repository, not local.

Good luck!

Freghar

Wouldn't <branch> be how you "defined" it?

What I mean is, master here is set as:

[branch "master"]

remote = origin

merge = refs/heads/master

and origin is defined as:

[remote "origin"]

url = [email protected]:MadJack/mangos.git

fetch = +refs/heads/*:refs/remotes/origin/*

So, wouldn't that mean the same as using my remote repos? Since Git wants to have a branch, I just can't give it "origin" with pull, but that amounts to the same thing right?

I'm not trying to argue or anything, just understand... :)

Oh and thank you! :D

Posted
Wouldn't <branch> be how you "defined" it?

What I mean is, master here is set as:

[branch "master"]

remote = origin

merge = refs/heads/master

and origin is defined as:

[remote "origin"]

url = [email protected]:MadJack/mangos.git

fetch = +refs/heads/*:refs/remotes/origin/*

So, wouldn't that mean the same as using my remote repos? Since Git wants to have a branch, I just can't give it "origin" with pull, but that amounts to the same thing right?

I'm not trying to argue or anything, just understand... :)

Oh and thank you! :D

The first config entry refers to "tracking branches" (see 2nd chapter), the second one is a definition of a remote. And you can actually do "git pull origin", which will fetch origin and merge origin's master ("merge = refs/heads/master").

And I say it again, rather than using this thread to explain things, see manpages of git-remote, git-pull and others ("git remote --help" in cygwin on windows). :)

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use