Page 1 of 1
How to push to GIT repository.
Posted: 21 Jun 2025, 09:05
by quietlyquietly
I have a patch ready for the server code.
I have gotten the GIT account.
I have set up there a separate fork of the repository called tmwAthena_qq.
I have entered it into my local GIT as a remote.
My first patch currently resides in my tmwAthena clone as branch qq001, but it will not allow me to push that branch to the repository.
I have been told that I need to push that patch to my own repository and request a merge.
What I am at a loss for is the exact GIT commands to accomplish this. Reading all the GIT help and manuals is not helping much.
There are just too many commands and too many possibilities for me to be guessing at this.
I have the patch as a patch file, so could apply that to a different branch.
I cannot switch to my tmwAthena_qq, so I have nothing I can apply it to.
Question: How do I apply patches to my tmwAthena_qq repository? This is primarily how do I make GIT give me a local copy of those files?
Is this another clone operation, and does that work on a remote?
What commands are the existing developers using to make their patches in their repositories?
I assume once I can get local access of it, I probably can create branches in it, and push them to the server.
I probably should also destroy the qq001 branch in my tmwAthena clone, as that is going nowhere.
Thank you,
qq
Re: How to push to GIT repository.
Posted: 22 Jun 2025, 18:49
by Bjørn
Your fork does not currently have your new branch (see https://git.themanaworld.org/quietlyqui ... -/branches). To push your local qq001 branch to your fork, first make sure you have your fork added as a remote to push to. In your local repo, do:
Code: Select all
git remote add qq https://git.themanaworld.org/quietlyquietly/tmw-athena-qq.git
(I'm using the https URL rather than the ssh URL since you indicated trouble setting up an SSH key in your email)
Now your local repository will have a remote called "qq" that points to your fork. You can now push the qq001 branch to it as follows:
(since we've used https above, this will probably prompt for a password or access token - there are several ways to have git remember that token to avoid repeated prompting, but this can be set up later)
If that branch indeed contains at least one new commit, then you should now be able to open a merge request for this branch to the main repository at https://git.themanaworld.org/tmw/tmwa (recently moved from "legacy" to "tmw"). The output of the "git push" command above should even contain a URL with which you can open that merge request.
Re: How to push to GIT repository.
Posted: 24 Jun 2025, 08:07
by quietlyquietly
OK, I got it pushed and submitted a merge request.
I already had tmwAthena_qq setup as that remote so I used it.
I assume that I can also do a pull on that remote repository.
One thing that bothers me, is how does changes to the repository get updated in my clone.
I could not find a GIT update.
Is my GIT clone going to change on its own, or do I have to issue some command ?
When the merge request gets approved, does my tmwAthena_qq get updated too ?
I assume the qq001 branch will be relative to that base and then will effectively get such updates too.
But there could be conflicts, so maybe not.
So maybe the qq001 branch will get stale relative to the master repository ?
Are there any other tasks I have to do to finish this patch ?
Re: How to push to GIT repository.
Posted: 24 Jun 2025, 08:40
by Bjørn
I see you have opened a merge request (https://git.themanaworld.org/quietlyqui ... requests/1), but it is requesting a merge from qq001 to master within your own fork. This isn't what you want. Instead, you need to open the merge request from your qq001 branch to the master branch in the upstream repository.
Maybe this URL could help: https://git.themanaworld.org/tmw/tmwa/- ... quests/new
- Leave "Target branch" set to tmw/tmwa and master.
- Select your fork in "Source branch" and then select your qq001 branch.
- Proceed with comparing the branches and opening the new merge request.
Another issue in your patch is that you've left the "broken" code in there, using preprocessor conditions to add your fixed version. This is unhelpful, since it makes it much harder to see the actual changes you have made. Please remove the preprocessor conditions and leave only your fixed code.
Now regarding updating of your fork or your local repository, as you've guessed these are manual steps because indeed there might be conflicts, and there are also multiple ways of doing this. When a merge request is merged, this will only change the target branch in the target repository. Usually, this is the master branch in the main tmw/tmwa repository. To update your local repository and optionally your fork, you would:
- If you have local uncommitted changes, consider stashing them away using 'git stash' - you can get them back later using 'git stash pop' (the stash works as a stack of changes that you have temporarily set aside).
- Use 'git switch master' to switch from "qq001" to "master" when necessary.
- Use 'git pull --ff-only' (in case "origin" is what points to the main tmw/tmwa repository) to fetch the latest changes and update your local "master" branch. The "--ff-only" option makes sure that it won't try to create a merge commit, which is never what you want in our workflow (if it complains, it means you've got local changes on your "master" branch, which you should avoid).
- If the above succeeded, use "git push tmwAthena_qq master" if you want to update the master branch of your fork (not actually necessary, though)
- Use "git switch -c qq002" (or any other branch name) to create a new branch based on updated "master" to prepare for further changes.
Note that you can do these steps at any time, also when qq001 isn't merged yet, if you want to propose any additional patches through additional merge requests which could potentially be merged independently. It's common for a developer to have multiple merge requests open at once that are awaiting review by others, each from their own branch.
Re: How to push to GIT repository.
Posted: 25 Jun 2025, 10:09
by quietlyquietly
Maybe this URL could help: https://git.themanaworld.org/tmw/tmwa/- ... quests/new
===> 404, not found.
The instructions for issuing a merge request seems to be missing the context where this is done.
I have to guess that the only place where it might make sense is if I change to the tmwAthena master GIT in my browser.
But then GIT must allow merging from another repository (like tmwAthena_qq) which is suspicious.
Isn't my tmwAthena a new independent repository that was just initialized from tmwAthena ?
There must be some special relationship that I have not understood yet. To me a fork of the code becomes a new project, living an independent life and diverging from the parent.
Why am I using a branch in my tmwAthena_qq to make changes. I could just modify the tmwAthena_qq master and then merge request that back to the parent repository tmwAthena ???
I have to suppose that a branch is needed in order to interface with GIT because there is no other way to get edits into GIT, and that remote repository is needed to get around merge security in GITLAB.
I usually leave the previous code in #if when it would help understanding of the patch, or debugging of new problems that might arise.
The old code is right there and you do not have to go searching for it.
I suppose you are reviewing it using git diff, which I noticed does not display that previous code when it is only bracketed in new #if constructs.
It works much better when using an editor on the source code.
It looks to me that if someone else is changing the repository there will be conflict. Because I have an older version of the code, my merge request is going to wipe out changes made to that repository since I last pulled.
The only way to avoid this is if GIT merges diffs instead of the branch code itself. Their docs should describe it that way, because what they do describe comes across as something different.
I am going to have to write a book on how to do all this using GIT. With subversion we only have to do "svn update", and our local copy gets updated with any new changes.
Re: How to push to GIT repository.
Posted: 25 Jun 2025, 11:06
by quietlyquietly
I edit the patch again to remove the old code.
Had to add the file because GIT refused to commit my edits.
git add src/map/script-fun.cpp
git commit -m "qq001 remove old code"
git diff master qq001 > ../git_patches/qq001d.diff
git push tmwAthena_qq qq001
[ [ rejected] qq001 --> qq001 (non-fast_forward)
error: failed to push some refs to 'https://git.themanaworld.org/quietlyqui ... ena-qq.git
hint: Updates were rejected because some of your current branch is behind
its remote counterpart. If you want to integrate the remote changes,
use "git pull" before pushing again.
See the note about 'fast-forwards' in git push --help for details.
I do not understand this, because that is my fork remote and it should not have changed since I last pushed to it.
The only other thing done was a merge request.
Did you do something to alter tmwAthena_qq ?
I do not dare do the pull because I don't know what has happened. It could wipe out my patch entirely.
Re: How to push to GIT repository.
Posted: 25 Jun 2025, 15:25
by Bjørn
Did you manually copy/paste the text, in which the URL was shortened using "...", rather than just clicking the link? The URL I linked to was:
Code: Select all
https://git.themanaworld.org/tmw/tmwa/-/merge_requests/new
quietlyquietly wrote: ↑25 Jun 2025, 11:06
I do not understand this, because that is my fork remote and it should not have changed since I last pushed to it.
Your fork will indeed not have changed, so likely your local branch changed in such a way that a fast-forward is no longer possible (for example, you may have rebased or amended your changes). If you are sure your local branch is fine and your remote branch can be replaced, do a force-push using "git push -f tmwAthena_qq qq001".
Re: How to push to GIT repository.
Posted: 26 Jun 2025, 07:04
by quietlyquietly
Force pushed to tmwAthena_qq.
GIT was refusing to allow my commit earlier, I did not know why or what to do about it, so I did try --amend because this seemed like it would amend the previous qq001.
I really do not know why GIT refused the commit (it was a simple edit to remove the old code), why --amend did not make it work, or even what --amend is for and what it does.
It is that way with just about every GIT command. They have incomplete explanations, and I have been using repositories on projects since year 2000, but none of them were GIT.
You should check if the new qq001 is now acceptable.
I am going to try to cancel the previous merge (and I do not expect that to go well as nothing else about GIT has gone smoothly).
Thank you for the help.
qq
Re: How to push to GIT repository.
Posted: 27 Jun 2025, 07:24
by quietlyquietly
That second version of the same link is still: 404 page not found.
I can copy/paste it just fine, or even click on it, and I still get 404.
https://git.themanaworld.org/tmw/tmwa/-/merge_requests
I tried:
https://git.themanaworld.org/tmw/tmwa/merge_requests
which redirected to:
https://git.themanaworld.org/tmw/tmwa/-/merge_requests
I see the qq001 is at the top of the merge_requests. OK ...
Cannot see anything that looks like "new", or any docs. Just a help button in the corner, which leads to a menu of GIT documents.
What were talking about that this was going to help with ??
I find GIT documentation to be most of the problem with all this. It reads like an advertisement of all the nifty features, mostly.
So, since this is question about "How to push and get a merge request", what is the next step ?? How long do I wait ??
Is there anything else that I need to do, like submit to cross examination of my presentation like this was my master's thesis.
The GITLab merge request page implies alot, but I then again I doubt we have that many concerned reviewers here.
Re: How to push to GIT repository.
Posted: 27 Jun 2025, 07:41
by Bjørn
Well, you did it at least! I don't know why that URL wasn't working for you, but you opened a merge request at https://git.themanaworld.org/tmw/tmwa/- ... quests/308 and I've left a bit of feedback.
Git is definitely not known for its smooth learning curve. I didn't stick with it either when I first tried it on some project back in 2008 and at the time I opted instead for Mercurial, which seemed much more friendly and more familiar (compared to Subversion). However, some months later I gave it another chance and it stuck. Sometimes existing experience can stand in the way of learning something new, but I'm sure you can find your way with it eventually as well!
Btw, it'd still be great if you could join our chatroom(s) so we can more directly communicate.
Re: How to push to GIT repository.
Posted: 27 Jun 2025, 12:33
by Hello=)
Just in case...
1) Thanks for making your chages. They look interesting and I'm looking forward to getting this on wheels.
2) I've added some comment about some of changes. Perhaps, you want to take a look?
3) Seems you run some customized world or something like this, and up for implementing some features of similar server systems. I wonder, what would you think of https://git.themanaworld.org/tmw/tmwa/- ... quests/304 - its chante to summon() builtin call. Its backward incompatible (relevant TMWA content refactor also in flight) and takes best of TMWA and Herc server systems - making summon() builtin superset of both. If you wonder how this could be used? For example, my local dev server runs prototype of "target sharing with summon" where certain strong summons can share target with their summonter, actively helping to fight target summoner fights, making summons smarter than ones seen in other similar server systems I'm aware of.