How do I merge my own fork with updates from the main fork
Chris Jones
jonesc at hep.phy.cam.ac.uk
Sat Aug 24 12:38:13 UTC 2019
Hi,
B.t.w. Its very much bad practise to make new commits directly to the master branch of your own fork. You should keep your master clean and only pull into it from the primary macports master, using the commands I just sent around.
If you wish to make new commits, for each in order to eventually submit a PR with them, *always* create a new feature branch, based off of master, for this. E.g.
git checkout master
sudo port -d sync
git checkout -b my-update-branch
Then make you commits there. When ready, push this branch to your github fork and make a PR with it.
Chris
> On 24 Aug 2019, at 12:38 pm, Gerben Wierda <gerben.wierda at rna.nl> wrote:
>
> This was helpful, except that the rebase failed. There were changes. I tried to repair but failed.
>
> Albus:macports-ports sysbh$ git fetch --all --prune
> Fetching origin
> Fetching upstream
> remote: Enumerating objects: 33, done.
> remote: Counting objects: 100% (33/33), done.
> remote: Compressing objects: 100% (5/5), done.
> remote: Total 20 (delta 12), reused 20 (delta 12), pack-reused 0
> Unpacking objects: 100% (20/20), done.
> From https://github.com/macports/macports-ports
> f9f924a097b..a825aeb3efc master -> upstream/master
> Albus:macports-ports sysbh$ git status
> On branch master
> Your branch is up to date with 'origin/master'.
>
> Changes not staged for commit:
> (use "git add <file>..." to update what will be committed)
> (use "git checkout -- <file>..." to discard changes in working directory)
>
> modified: net/nsd/Portfile
>
> Untracked files:
> (use "git add <file>..." to include in what will be committed)
>
> net/nsd/%Portfile
> net/nsd/Portfile-gw-20190817
> net/nsd/Portfile.orig
> net/unbound/%Portfile
> net/unbound/Portfile-gw-20190817
> net/unbound/Portfile.orig
>
> no changes added to commit (use "git add" and/or "git commit -a")
> Albus:macports-ports sysbh$ git checkout master
> M net/nsd/Portfile
> Already on 'master'
> Your branch is up to date with 'origin/master'.
> Albus:macports-ports sysbh$ git rebase upstream/master
> error: cannot rebase: You have unstaged changes.
> error: Please commit or stash them.
> Albus:macports-ports sysbh$ git reset
> Unstaged changes after reset:
> M net/nsd/Portfile
> Albus:macports-ports sysbh$ git checkout .
> Albus:macports-ports sysbh$ git status
> On branch master
> Your branch is up to date with 'origin/master'.
>
> Untracked files:
> (use "git add <file>..." to include in what will be committed)
>
> net/nsd/%Portfile
> net/nsd/Portfile-gw-20190817
> net/nsd/Portfile.orig
> net/unbound/%Portfile
> net/unbound/Portfile-gw-20190817
> net/unbound/Portfile.orig
>
> nothing added to commit but untracked files present (use "git add" to track)
> Albus:macports-ports sysbh$ git rebase upstream/master
> First, rewinding head to replay your work on top of it...
> Applying: Updated nsd to 4.2.1, added startupitem to nsd, added @gctwnl as maintainer
> Using index info to reconstruct a base tree...
> M net/nsd/Portfile
> M net/unbound/Portfile
> Falling back to patching base and 3-way merge...
> Auto-merging net/unbound/Portfile
> CONFLICT (content): Merge conflict in net/unbound/Portfile
> Auto-merging net/nsd/Portfile
> CONFLICT (content): Merge conflict in net/nsd/Portfile
> error: Failed to merge in the changes.
> Patch failed at 0001 Updated nsd to 4.2.1, added startupitem to nsd, added @gctwnl as maintainer
> hint: Use 'git am --show-current-patch' to see the failed patch
>
> Resolve all conflicts manually, mark them as resolved with
> "git add/rm <conflicted_files>", then run "git rebase --continue".
> You can instead skip this commit: run "git rebase --skip".
> To abort and get back to the state before "git rebase", run "git rebase --abort".
>
> Albus:macports-ports sysbh$ cd net/unbound/
> Albus:unbound sysbh$ ls -l
> total 40
> -rw-r--r-- 1 sysbh staff 3957 Aug 17 14:35 %Portfile
> -rw-r--r-- 1 sysbh staff 4106 Aug 24 13:29 Portfile
> -rw-r--r-- 1 sysbh staff 3979 Aug 17 14:23 Portfile-gw-20190817
> -rw-r--r-- 1 sysbh staff 3487 Aug 14 21:20 Portfile.orig
> Albus:unbound sysbh$ rm %Portfile Portfile Portfile-gw-20190817
> Albus:unbound sysbh$ mv Portfile.orig Portfile
> Albus:unbound sysbh$ cd ../nsd
> Albus:nsd sysbh$ rm %Portfile Portfile Portfile-gw-20190817
> Albus:nsd sysbh$ mv Portfile.orig Portfile
> Albus:nsd sysbh$ ls -l
> total 8
> -rw-r--r-- 1 sysbh staff 2052 Aug 14 21:20 Portfile
> Albus:nsd sysbh$ cd ../..
> Albus:macports-ports sysbh$ git rebase upstream/master
> fatal: It seems that there is already a rebase-apply directory, and
> I wonder if you are in the middle of another rebase. If that is the
> case, please try
> git rebase (--continue | --abort | --skip)
> If that is not the case, please
> rm -fr ".git/rebase-apply"
> and run me again. I am stopping in case you still have something
> valuable there.
>
> Albus:macports-ports sysbh$ git rebase --continue
> net/nsd/Portfile: needs merge
> net/unbound/Portfile: needs merge
> You must edit all merge conflicts and then
> mark them as resolved using git add
> Albus:macports-ports sysbh$ rm -fr ".git/rebase-apply"
> Albus:macports-ports sysbh$ git rebase upstream/master
> net/nsd/Portfile: needs merge
> net/unbound/Portfile: needs merge
> error: cannot rebase: You have unstaged changes.
> error: additionally, your index contains uncommitted changes.
> error: Please commit or stash them.
> Albus:macports-ports sysbh$ git checkout .
> error: path 'net/nsd/Portfile' is unmerged
> error: path 'net/unbound/Portfile' is unmerged
> Albus:macports-ports sysbh$ git help checkout
> Albus:macports-ports sysbh$ git checkout -f .
> warning: path 'net/nsd/Portfile' is unmerged
> warning: path 'net/unbound/Portfile' is unmerged
> Albus:macports-ports sysbh$ git help checkout
>
>
>> On 24 Aug 2019, at 12:32, miniupnp <miniupnp at free.fr> wrote:
>>
>> Hello,
>>
>> Well, it looks like you have added 6 commits in you master branch.
>> $ git status
>> should tell you that.
>> Merging upstream/master doesn't remove theses commits.
>> It just "merges" new commits from the upstream/master branch into your current branch.
>>
>> To understand what is in your branch, you should use the command :
>> $ git log --graph --decorate --all
>>
>> the github graph is also useful :
>> https://github.com/gctwnl/macports-ports/network
>>
>> What exactly do you want to do ?
>> - have your master branch perfectly in sync with upstream/master ?
>> In that case you should only commit in some other "work" branches.
>>
>> - use your master branch as a "work" branch.
>> In that case I advise you to rebase on the upstream master.
>>
>> $ git fetch --all --prune
>> $ git checkout master
>> $ git rebase upstream/master
>> $ git push --force origin master
>>
>>
>>
>>> Le 24/08/2019 à 12:12, Gerben Wierda a écrit :
>>> I’ve created my own git fork of macports to work on port updates (have submitted one pull request so far).
>>>
>>> Now ether is (for me) macports/macports-ports and gctwnl/macports-ports (the one from which I’ve created a pull request).
>>>
>>> It is not perfectly clear to me how I get the updates from macports/macports-ports back into my fork and be totally in sync.
>>>
>>> On my local machine, I see this in my macports-ports directory:
>>>
>>> Albus:macports-ports sysbh$ git remote -v
>>> origin https://github.com/gctwnl/macports-ports.git (fetch)
>>> origin https://github.com/gctwnl/macports-ports.git (push)
>>> upstream https://github.com/macports/macports-ports.git (fetch)
>>> upstream https://github.com/macports/macports-ports.git (push)
>>>
>>> So, only my own. These are the commands I ran locally:
>>>
>>> 14 git fetch upstream
>>> 15 git merge upstream/master
>>> 22 git push
>>>
>>> But instead of being in sync, GitHub.com for gctwnl/macports-ports branch master says:
>>>
>>> This branch is 6 commits ahead of macports:master.
>>>
>>> So, I am obviously missing something.
>>>
>>> Gerben Wierda
>>> Chess and the Art of Enterprise Architecture
>>> Mastering ArchiMate
>>> Architecture for Real Enterprises at InfoWorld
>>> On Slippery Ice at EAPJ
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20190824/68782ed8/attachment.html>
More information about the macports-users
mailing list