How do I merge my own fork with updates from the main fork

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I merge my own fork with updates from the main fork

Gerben Wierda
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:

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.


Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Gerben Wierda
Let me add that after the commands below, I get

Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.

I’m a bit worried about having both the port command and git update the same tree.


On 24 Aug 2019, at 12:12, Gerben Wierda <[hidden email]> wrote:

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:

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.



Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

miniupnp
In reply to this post by Gerben Wierda
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:

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.



Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Chris Jones


On 24 Aug 2019, at 11:32 am, miniupnp <[hidden email]> 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:


I recommend changing the above so the primary macports repo is called origin, and you call your fork something. Things tend to work more smoothly this way.

Once you have done this, assuming you have configured macports to use your checkout as its primary source, a simple

sudo port sync

Will do what is required.

Note, to see what the above is actually doing, use the debug printout option

sudo port -d sync

Chris

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.



Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Gerben Wierda
In reply to this post by miniupnp
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.
   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 <[hidden email]> 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:

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.




Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Chris Jones
Hi,

If you have unstated changes, you have to stash them before rebasing.

That is why I suggested to use 

sudo port sync

as it handles all this for you. Under the hood it does

git pull —rebase —autostash origin master

assuming origin is the primary MacPorts repo.

Chris

On 24 Aug 2019, at 12:38 pm, Gerben Wierda <[hidden email]> 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.
   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 <[hidden email]> 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:

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.






smime.p7s (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Chris Jones


On 24 Aug 2019, at 1:28 pm, Christopher Jones <[hidden email]> wrote:

Hi,

If you have unstated changes, you have to stash them before rebasing.

unstated -> unstaged ….


That is why I suggested to use 

sudo port sync

as it handles all this for you. Under the hood it does

git pull —rebase —autostash origin master

assuming origin is the primary MacPorts repo.

Chris

On 24 Aug 2019, at 12:38 pm, Gerben Wierda <[hidden email]> 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.
   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 <[hidden email]> 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:

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.







smime.p7s (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Chris Jones
In reply to this post by Gerben Wierda
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 <[hidden email]> 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.
   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 <[hidden email]> 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:

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.




Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Gerben Wierda
In reply to this post by Chris Jones
Thanks.

On 24 Aug 2019, at 12:40, Chris Jones <[hidden email]> wrote:

I recommend changing [the setup] so the primary macports repo is called origin, and you call your fork something. Things tend to work more smoothly this way.

OK. So how do I rename these? Or how should I have created them in the first place? I can of course throw everything away and start anew. At this point, I need to find out how to get back to a working situation.

If you have unstated changes, you have to stash them before rebasing.

’stash’ is just ‘move them out of the way’ or is it something git?

That is why I suggested to use 

sudo port sync

as it handles all this for you. Under the hood it does

git pull —rebase —autostash origin master

assuming origin is the primary MacPorts repo.

Aha.

I have of course two repos:

~/MacPortsDev/macports-ports

And my sources.conf says:

<a href="rsync://rsync.macports.org/macports/release/tarballs/ports.tar" class="">rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default]

So that ~/MacPortsDev/macports-ports is the tree used for the port install etc. commands

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.

Yeah, I understand. It was the current status though.

I have been trying to follow instructions but I am trying to prevent to have to become a git expert (there is insufficient time for that available, such as studying a whole git book). Just knowing some basic recipes for actions/steps lets me concentrate on the actual stuff I want to do that is potentially contributing to ports.

G
Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Chris Jones
Hi,

On 24 Aug 2019, at 1:55 pm, Gerben Wierda <[hidden email]> wrote:

Thanks.

On 24 Aug 2019, at 12:40, Chris Jones <[hidden email]> wrote:

I recommend changing [the setup] so the primary macports repo is called origin, and you call your fork something. Things tend to work more smoothly this way.

OK. So how do I rename these? Or how should I have created them in the first place? I can of course throw everything away and start anew. At this point, I need to find out how to get back to a working situation.

You can rename remotes. See

git remote —help



If you have unstated changes, you have to stash them before rebasing.

’stash’ is just ‘move them out of the way’ or is it something git?

its way more than just moving them out the way.  Mote like a temporary commit. again, see

git stash —help

cheers Chris


That is why I suggested to use 

sudo port sync

as it handles all this for you. Under the hood it does

git pull —rebase —autostash origin master

assuming origin is the primary MacPorts repo.

Aha.

I have of course two repos:

~/MacPortsDev/macports-ports

And my sources.conf says:

<a href="rsync://rsync.macports.org/macports/release/tarballs/ports.tar" class="">rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default]

So that ~/MacPortsDev/macports-ports is the tree used for the port install etc. commands

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.

Yeah, I understand. It was the current status though.

I have been trying to follow instructions but I am trying to prevent to have to become a git expert (there is insufficient time for that available, such as studying a whole git book). Just knowing some basic recipes for actions/steps lets me concentrate on the actual stuff I want to do that is potentially contributing to ports.

G


smime.p7s (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

ryandesign2
Administrator
In reply to this post by Gerben Wierda


On Aug 24, 2019, at 07:55, Gerben Wierda wrote:

> I have been trying to follow instructions but I am trying to prevent to have to become a git expert (there is insufficient time for that available, such as studying a whole git book). Just knowing some basic recipes for actions/steps lets me concentrate on the actual stuff I want to do that is potentially contributing to ports.
>

We have some help available here:

https://trac.macports.org/wiki/WorkingWithGit

We needed a cheat sheet for people like you and me who don't have time to learn git, and other developers more familiar with git thankfully pitched in to write that. If it's missing anything you'd find helpful, please add it or suggest what should be added.

Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Chris Jones


On 24 Aug 2019, at 3:47 pm, Ryan Schmidt <[hidden email]> wrote:



On Aug 24, 2019, at 07:55, Gerben Wierda wrote:

I have been trying to follow instructions but I am trying to prevent to have to become a git expert (there is insufficient time for that available, such as studying a whole git book). Just knowing some basic recipes for actions/steps lets me concentrate on the actual stuff I want to do that is potentially contributing to ports.


We have some help available here:

https://trac.macports.org/wiki/WorkingWithGit

Thanks, I forgot about that page.

Of course, there is also the man page at


;)

Chris

We needed a cheat sheet for people like you and me who don't have time to learn git, and other developers more familiar with git thankfully pitched in to write that. If it's missing anything you'd find helpful, please add it or suggest what should be added.

Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Gerben Wierda
In reply to this post by ryandesign2
Yes, those were among the instructions I followed. But that gets me the situation of which now is said doesn’t fit with port sync. e.g. those instructions means my own fork is called origin and the macports fork is called upstream. But port sync assumes differently (if I understand it correctly)

As I understand it, I need my own fork gctwnl/macports-ports because I am not allowed to push to macports/macports-ports and I need to work with branches inside my own fork. But how that whole landscape (a) keeps synchronised and (b) works with the port command is unclear, also after reading that info.


On 24 Aug 2019, at 16:47, Ryan Schmidt <[hidden email]> wrote:



On Aug 24, 2019, at 07:55, Gerben Wierda wrote:

I have been trying to follow instructions but I am trying to prevent to have to become a git expert (there is insufficient time for that available, such as studying a whole git book). Just knowing some basic recipes for actions/steps lets me concentrate on the actual stuff I want to do that is potentially contributing to ports.


We have some help available here:

https://trac.macports.org/wiki/WorkingWithGit

We needed a cheat sheet for people like you and me who don't have time to learn git, and other developers more familiar with git thankfully pitched in to write that. If it's missing anything you'd find helpful, please add it or suggest what should be added.


Reply | Threaded
Open this post in threaded view
|

Re: How do I merge my own fork with updates from the main fork

Chris Jones
Hi,

The names remotes are given are completely arbitrary. It s normal to have one called origin, and the rest something else, but it is not mandatory to have that.

It is true the instructions below in places assume you will call your fork origin and the main MP one something else, and I tend to recommend the opposite. But, as long as you know what *you* called your remotes its easy to adapt any instructions to your situation.

If you have not called the main MP repo origin, then you can still sync with it.

> git pull —rebase —autostash <XYZ> master
> sudo portindex

replace <XYZ> with whatever you have called the remote in your checkout for the main MP repo.

The above is in effect what 'sudo port sync’  does, if you have set things up such that port uses your checkout as its main source. However, it is not mandatory to use port sync, the above has the same result.

Chris

On 24 Aug 2019, at 4:06 pm, Gerben Wierda <[hidden email]> wrote:

Yes, those were among the instructions I followed. But that gets me the situation of which now is said doesn’t fit with port sync. e.g. those instructions means my own fork is called origin and the macports fork is called upstream. But port sync assumes differently (if I understand it correctly)

As I understand it, I need my own fork gctwnl/macports-ports because I am not allowed to push to macports/macports-ports and I need to work with branches inside my own fork. But how that whole landscape (a) keeps synchronised and (b) works with the port command is unclear, also after reading that info.


On 24 Aug 2019, at 16:47, Ryan Schmidt <[hidden email]> wrote:



On Aug 24, 2019, at 07:55, Gerben Wierda wrote:

I have been trying to follow instructions but I am trying to prevent to have to become a git expert (there is insufficient time for that available, such as studying a whole git book). Just knowing some basic recipes for actions/steps lets me concentrate on the actual stuff I want to do that is potentially contributing to ports.


We have some help available here:

https://trac.macports.org/wiki/WorkingWithGit

We needed a cheat sheet for people like you and me who don't have time to learn git, and other developers more familiar with git thankfully pitched in to write that. If it's missing anything you'd find helpful, please add it or suggest what should be added.




smime.p7s (2K) Download Attachment