It is currently 23 Apr 2024, 19:58
   
Text Size

Git syncing fork confusion/issues

Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins

Git syncing fork confusion/issues

Postby escplan9 » 03 Mar 2016, 14:17

I earlier submitted some local changes. Before I did any more local changes, I wanted to sync my fork to the upstream master. I followed gits guide here: https://help.github.com/articles/syncing-a-fork/

This is what I did:

C:\Users\Derek\Documents\NetBeansProjects\mage>git remote -v
origin https://github.com/drmDev/mage.git (fetch)
origin https://github.com/drmDev/mage.git (push)
upstream https://github.com/magefree/mage.git (fetch)
upstream https://github.com/magefree/mage.git (push)

C:\Users\Derek\Documents\NetBeansProjects\mage>git fetch upstream
remote: Counting objects: 4673, done.
remote: Compressing objects: 100% (65/65), done.
Receiving objects: 100% (4673/4673), 1.93 MiB | 2.14 MiB/s, done.eused 2419 eceiving objects: 100% (4673/4673), 1.07 MiB | 2.14 MiB/s
Resolving deltas: 0% (0/3054)
Resolving deltas: 100% (3054/3054), completed with 803 local objects.
From https://github.com/magefree/mage
* [new branch] DeckEditor -> upstream/DeckEditor
* [new branch] MCTS_AI_Improvements -> upstream/MCTS_AI_Improvements
* [new branch] Network_Upgrade -> upstream/Network_Upgrade
* [new branch] master -> upstream/master

C:\Users\Derek\Documents\NetBeansProjects\mage>git checkout master
Already on 'master'
Your branch is up-to-date with 'origin/master'.

C:\Users\Derek\Documents\NetBeansProjects\mage>git merge upstream/master
Merge made by the 'recursive' strategy.
.../java/mage/client/components/ColorPane.java | 65 +++++++----
.../mage/client/deck/generator/DeckGenerator.java | 2 +-
.../client/deck/generator/DeckGeneratorDialog.java | 39 ++++---
.../client/deck/generator/DeckGeneratorPool.java | 7 +-
.../java/mage/client/dialog/PreferencesDialog.java | 1 +
.../plugins/adapters/MageActionCallback.java | 30 ++---
.../mage/plugins/card/info/CardInfoPaneImpl.java | 41 +++----
.../mage/sets/blessedvscursed/EerieInterlude.java | 125 +++++++++++++++++++++
.../sets/shadowsoverinnistrad/EerieInterlude.java | 52 +++++++++
.../sets/shadowsoverinnistrad/StichedMangler.java | 82 ++++++++++++++
.../test/cards/abilities/enters/BloodMoonTest.java | 66 ++++++-----
11 files changed, 406 insertions(+), 104 deletions(-)
create mode 100644 Mage.Sets/src/mage/sets/blessedvscursed/EerieInterlude.java
create mode 100644 Mage.Sets/src/mage/sets/shadowsoverinnistrad/EerieInterlude.java
create mode 100644 Mage.Sets/src/mage/sets/shadowsoverinnistrad/StichedMangler.java

C:\Users\Derek\Documents\NetBeansProjects\mage>git branch
* master

C:\Users\Derek\Documents\NetBeansProjects\mage>git rebase master
Current branch master is up to date.

Here is where I followed the Developer Getting Started guide with regards to rebase to avoid merge commits

C:\Users\Derek\Documents\NetBeansProjects\mage>git fetch origin
From https://github.com/drmDev/mage
* [new branch] DeckEditor -> origin/DeckEditor
* [new branch] MCTS_AI_Improvements -> origin/MCTS_AI_Improvements
* [new branch] Network_Upgrade -> origin/Network_Upgrade

C:\Users\Derek\Documents\NetBeansProjects\mage>git status
On branch master
Your branch is ahead of 'origin/master' by 9 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean

C:\Users\Derek\Documents\NetBeansProjects\mage>git rebase origin/master
First, rewinding head to replay your work on top of it...
Applying: Fix first card tooltip show.
Applying: [SOI] Added Eerie Interlude and Stiched Mangler.
Applying: Make DeckGeneratorDialog fields non-static for more OOP-style.
Applying: Add colorless mana filter to deck generator.
Applying: Modified Blood Moon test.

C:\Users\Derek\Documents\NetBeansProjects\mage>git status
On branch master
Your branch is ahead of 'origin/master' by 5 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean

C:\Users\Derek\Documents\NetBeansProjects\mage>git push
......
Writing objects: 100% (69/69), 10.07 KiB | 0 bytes/s, done.
Total 69 (delta 33), reused 32 (delta 6)
To https://github.com/drmDev/mage.git
a14a23d..598901e master -> master

C:\Users\Derek\Documents\NetBeansProjects\mage>git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

========================================

What I was trying to do was cleanly merge upstream/master into my origin/master. The git guide made it sound like that was what I was doing "Merge the changes from upstream/master into your local master branch. This brings your fork's master branch into sync with the upstream repository, without losing your local changes.". I'm not sure exactly what I ended up doing here as I made a mess in the following commits which included all these merges as well as some new changes I added.

Perhaps it was just me following the git guide which forced there to be these merges? If I just did
git fetch origin
git rebase origin/master

Would that have led to a less sloppy commit?
escplan9
 
Posts: 257
Joined: 10 Aug 2015, 22:38
Has thanked: 26 times
Been thanked: 40 times

Re: Git syncing fork confusion/issues

Postby escplan9 » 03 Mar 2016, 19:56

I'm just terrible with git. I use HG Mercurial regularly but haven't wrapped my head around git. Anyways... I ended up just backing up the new changes I made, blowing up my git repo, closing my existing pull request, and starting from a new local directory for cloning the xmage master. It's back where it should be now with a new pull request with just the commits I wanted.
escplan9
 
Posts: 257
Joined: 10 Aug 2015, 22:38
Has thanked: 26 times
Been thanked: 40 times

Re: Git syncing fork confusion/issues

Postby escplan9 » 03 Mar 2016, 22:13

So let's say I don't feel like blowing up my repository again when I want to contribute :lol:

I have origin URL set to my own github repo
I have upstream URL set to the xmage github repo

The Developer Getting Started guide recommends the following to avoid excessive merge commits:

git fetch origin
git rebase origin/master


This confuses me. I have a fork setup between the xmage git repo and my own git repo. My "origin" points at my forked version of xmage repo and "upstream" points to the non-forked xmage git repo. Why would I do a fetch for latest changes on my own repo (origin)? Shouldn't it be git fetch upstream? And then similarly when I want to merge my changes git rebase upstream/master?

The way I'm describing above is also what is recommended in the github article on syncing a fork: https://help.github.com/articles/syncing-a-fork/

Can someone clear this up for me?
escplan9
 
Posts: 257
Joined: 10 Aug 2015, 22:38
Has thanked: 26 times
Been thanked: 40 times

Re: Git syncing fork confusion/issues

Postby LevelX » 04 Mar 2016, 00:27

I have no problems with the merge commits.

I'm not working with the pull requests normally, so I'm no expert for that.

I only know that git can sometimes be a beast I you (like I) don't know always exactly what it does.
So I always try to avoid rebases If I can. I had no good experiances with that.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: Git syncing fork confusion/issues

Postby escplan9 » 04 Mar 2016, 01:05

I see. I'll try a simple merge commit next time. I have some more tests (Disrupting Shoal bug report).
escplan9
 
Posts: 257
Joined: 10 Aug 2015, 22:38
Has thanked: 26 times
Been thanked: 40 times

Re: Git syncing fork confusion/issues

Postby escplan9 » 04 Mar 2016, 01:20

Well, got it to work now. Here's what I did in my situation with origin url pointed at my fork, and upstream url pointed at xmage repo:

Get the latest changes and commit/push this merge to my repo
git fetch upstream
git checkout master
git merge upstream/master
git commit -m "merge"
git push

Commit and push new local changes to my repo, then create new pull request
git commit -a -m "new tests commit message"
git push

Hooray! I am not as horrible as I thought =D>
escplan9
 
Posts: 257
Joined: 10 Aug 2015, 22:38
Has thanked: 26 times
Been thanked: 40 times


Return to Developers Talk

Who is online

Users browsing this forum: No registered users and 7 guests


Who is online

In total there are 7 users online :: 0 registered, 0 hidden and 7 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 7 guests

Login Form