aliens

Author Topic: Small Git-Question about pull-requests  (Read 8691 times)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #15 on: November 01, 2022, 02:27:42 pm »
Both are unrelated, my requites were for merging anything with OXCE master branch, Meridian make new working branch to allow your work be accessible for other people.

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #16 on: November 04, 2022, 01:48:20 am »
Here's your feature branch: https://github.com/MeridianOXC/OpenXcom/tree/new-ai
May I ask for another? I actually found someone who's willing to stream it. I'm really intruiged how he'll do! :D

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9085
    • View Profile

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #18 on: November 04, 2022, 12:36:04 pm »
Thanks again @Merdian! :)

And @Finnik or for that matter everyone else wanting to use my changes in their fork:

Since you asked me for a PR on Discord, you probably are not aware of the following git-trick I learned while working with other modders on Remnants of the Precursors:

Open the console from your git-application and type:

git remote add <short remote name> <remote URL>

e.g:
git remote add brutal https://github.com/Xilmi/OpenXcom.git

This needs only to be done only once.

From then on you can always run:

git fetch brutal

Which should add the options to merge any of my branches in a similar way you can merge with upstream-master.

It's a very convenient way for staying up to date with the forks of several other people without having to ask them for pull-requests.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #19 on: November 04, 2022, 06:58:14 pm »
oh, thanks! I'm not a professional developer and not very familiar to git stuff =)

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #20 on: November 06, 2022, 04:15:12 am »
oh, thanks! I'm not a professional developer and not very familiar to git stuff =)
I am and I wasn't either! :D So I figured I just spread what I had recently learned from someone else. We don't use git at the company. It's one of these things that can be really powerful if you know how to tap into that power.
An even better feature to me was that you can set it up as a build-server somehow... And I know there's people out there who can do this. I kinda want this magic someone made for me for ROTP for Xcom too! :o

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #21 on: November 07, 2022, 10:20:47 am »
I had a weird effect when I did my last pull-request.
It made me do a manual merge, which I don't really understand why. No one else had made any changes to these files. So shouldn't it just overwrite the older stuff with the newer stuff?

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #22 on: November 07, 2022, 11:41:47 am »
look how PR was merged.
usually in OXC its done using rebase to have linear history, this mean your local branch could obsolete as it have old commits before rebase.

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #23 on: November 07, 2022, 12:06:27 pm »
To be honest I've heard about "rebase" before but I never really looked into what it means and how to do it. Should probably look into it now. It's probably one of the many things that can make your life much easier knowing about when it comes to using git.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #24 on: November 07, 2022, 12:16:20 pm »
rebase in context of merge of PR mean that all your commits were copied on this target branch.
this is to have linear git history as all new commits start from last commit from this brach.

Its always best check some online documentations like:
https://www.atlassian.com/git/tutorials/merging-vs-rebasing
or any other that discusse topic like this.

To sum up, when PR cause rebase your old branch still have old version of tour commits and when you want merge it again with PR branch git by defualt do not know who handle both version and ask you to merge normally (without rebase) to solve all possible conflicts.

Its best to avoid cases like this where you have multiple duplicated same commits, best if you reset your working branch to one that is on PR to have same history as this PR branch (but you should be careful with reset as it can drop local changes)

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9085
    • View Profile

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9085
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #26 on: November 18, 2022, 10:43:39 pm »
you know, no matter how hard you try... it is simply NOT possible for me to rebase-merge your PR if it contains non-linear history... e.g. the merges you did from the main branch

the point of a "feature branch" is to develop your feature, not merge other branches... and once your feature is fully developed, then that feature can be merged into a main branch... not the other way around (at least that's what the book says)

the only merge I can make for your current PRs are squash-merges if you continue working the way you work... I don't have a problem with that... but it will become a bigger and bigger pain in the ass for you after every iteration... just saying

the newest build is here: https://lxnt.wtf/oxem/builds//ExtendedTests/BrutalAI-7.8.4.1-test-31a366607-2022-11-18-win64.7z

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #27 on: February 05, 2023, 07:25:30 pm »
Ouch. The changes for 7.8.8 created 39 merge-conflicts with my branch. And by the looks of it it's not a trivial: "Just take my stuff"-merge. I guess I'll postpone the merge a little.  :-X

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9085
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #28 on: February 06, 2023, 11:03:37 pm »
It's not as bad as it looks.

I've been doing OXC -> OXCE and OXCE -> OXCE+ merges for years, you get used to it :)
And it's a good way to learn.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Small Git-Question about pull-requests
« Reply #29 on: February 07, 2023, 01:26:08 pm »
Ouch. The changes for 7.8.8 created 39 merge-conflicts with my branch. And by the looks of it it's not a trivial: "Just take my stuff"-merge. I guess I'll postpone the merge a little.  :-X
remember to use 3-way merge option, you will see original code and see what each branch changed.