Can't sync cpython main to my fork

(Sorry, this is probably not really python-dev material, but I'm stuck trying to bring my fork into sync with python/cpython.) I don't know if I did something to my fork or if the master->main change did something to me, but I am unable to sync my smontanaro/cpython main with the python/cpython main. The dev guide gives this simple recipe: git checkout main git pull upstream main git push origin main Here's how that goes: (python39) rvm% git co main Already on 'main' Your branch is up to date with 'upstream/main'. (python39) rvm% git pull upstream main From git://github.com/python/cpython * branch main -> FETCH_HEAD Already up to date. (python39) rvm% git push origin main To github.com:smontanaro/cpython.git ! [rejected] main -> main (non-fast-forward) error: failed to push some refs to 'github.com:smontanaro/cpython.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. I looked at the fast-forward stuff in 'git push --help' but couldn't decipher what it told me, or more importantly, how it related to my problem. It's not clear to me how python/cpython:main can be behind smontanaro/cpython:main. I've attached my .git/config file in case that provides clues to the Git aficionados. Thx... Skip

Your main branch in GitHub has some commits they are not in python/cpython. https://github.com/smontanaro/cpython/commits/main If you don't mind to trash all changes in your local and Github main branch, you can sync main branches by: # delete all changes in your worktree and main branch. $ git reset --hard upstream/main # delete all changes in your Github main branch. $ git push --force origin main On Thu, May 6, 2021 at 9:41 PM Skip Montanaro <skip.montanaro@gmail.com> wrote:
-- Inada Naoki <songofacandy@gmail.com>

Thanks for the recipe to fix my problem. Your main branch in GitHub has some commits they are not in python/cpython.
Is there a way to easily tell how they differ? My (obvious to me, but wrong) guess was git diff upstream/main origin/main Then I went to Github and compared my fork with python/cpython: https://github.com/python/cpython/compare/main...smontanaro:main It appears I might have screwed the pooch by accepting Github's recent pull request. I'm just a gitiot. How am I supposed to know not to accept their PRs? Skip

Your main branch in GitHub has some commits they are not in python/cpython. https://github.com/smontanaro/cpython/commits/main
Regarding this. How else am I to keep my fork in sync with python/cpython other than by the occasional pull upstream/push origin process? That's what all those merges are. Is that first commit (Github (un)Dependabot) the culprit, or are all the other git merge results also problematic? Skip

El jue, 6 may 2021 a las 6:58, Skip Montanaro (<skip.montanaro@gmail.com>) escribió:
Maybe others have different workflows, but I don't see much of a need for keeping your fork's main branch up to date. My workflow is something like this: % git remote -v origin git@github.com:JelleZijlstra/cpython.git (fetch) origin git@github.com:JelleZijlstra/cpython.git (push) upstream https://github.com/python/cpython.git (fetch) upstream https://github.com/python/cpython.git (push) % git checkout main Already on 'main' Your branch is up to date with 'upstream/main'. % git pull ... get new changes from upstream % git checkout -b myfeature ... write my code % git push -u origin myfeature ... open a pull request So my local main branch tracks upstream/main (the real CPython repo), not origin/main (my fork).

Thanks. Up until the 3.10 split I was tracking main from a development branch in my fork, and trying — lately pretty much unsuccessfully — to drink from the firehose of changes to the virtual machine code. It made sense to me to keep my fork's main up-to-date with upstream/main. Now that I have diverged to follow the 3.10 branch for now, that's less of an issue. Skip

On 5/6/21 7:14 AM, Jelle Zijlstra wrote:
Maybe others have different workflows, but I don't see much of a need for keeping your fork's main branch up to date.
I will occasionally do a `git push origin main` just to shut up the messages about being behind/ahead; other than that, I have no idea why I would need origin to be up to date. -- ~Ethan~

Just today, GitHub launched a new feature to sync a branch with upstream via the web UI. https://github.blog/changelog/2021-05-06-sync-an-out-of-date-branch-of-a-for... On Thu., May 6, 2021, 15:16 Ethan Furman, <ethan@stoneleaf.us> wrote:

Your main branch in GitHub has some commits they are not in python/cpython. https://github.com/smontanaro/cpython/commits/main If you don't mind to trash all changes in your local and Github main branch, you can sync main branches by: # delete all changes in your worktree and main branch. $ git reset --hard upstream/main # delete all changes in your Github main branch. $ git push --force origin main On Thu, May 6, 2021 at 9:41 PM Skip Montanaro <skip.montanaro@gmail.com> wrote:
-- Inada Naoki <songofacandy@gmail.com>

Thanks for the recipe to fix my problem. Your main branch in GitHub has some commits they are not in python/cpython.
Is there a way to easily tell how they differ? My (obvious to me, but wrong) guess was git diff upstream/main origin/main Then I went to Github and compared my fork with python/cpython: https://github.com/python/cpython/compare/main...smontanaro:main It appears I might have screwed the pooch by accepting Github's recent pull request. I'm just a gitiot. How am I supposed to know not to accept their PRs? Skip

Your main branch in GitHub has some commits they are not in python/cpython. https://github.com/smontanaro/cpython/commits/main
Regarding this. How else am I to keep my fork in sync with python/cpython other than by the occasional pull upstream/push origin process? That's what all those merges are. Is that first commit (Github (un)Dependabot) the culprit, or are all the other git merge results also problematic? Skip

El jue, 6 may 2021 a las 6:58, Skip Montanaro (<skip.montanaro@gmail.com>) escribió:
Maybe others have different workflows, but I don't see much of a need for keeping your fork's main branch up to date. My workflow is something like this: % git remote -v origin git@github.com:JelleZijlstra/cpython.git (fetch) origin git@github.com:JelleZijlstra/cpython.git (push) upstream https://github.com/python/cpython.git (fetch) upstream https://github.com/python/cpython.git (push) % git checkout main Already on 'main' Your branch is up to date with 'upstream/main'. % git pull ... get new changes from upstream % git checkout -b myfeature ... write my code % git push -u origin myfeature ... open a pull request So my local main branch tracks upstream/main (the real CPython repo), not origin/main (my fork).

Thanks. Up until the 3.10 split I was tracking main from a development branch in my fork, and trying — lately pretty much unsuccessfully — to drink from the firehose of changes to the virtual machine code. It made sense to me to keep my fork's main up-to-date with upstream/main. Now that I have diverged to follow the 3.10 branch for now, that's less of an issue. Skip

On 5/6/21 7:14 AM, Jelle Zijlstra wrote:
Maybe others have different workflows, but I don't see much of a need for keeping your fork's main branch up to date.
I will occasionally do a `git push origin main` just to shut up the messages about being behind/ahead; other than that, I have no idea why I would need origin to be up to date. -- ~Ethan~

Just today, GitHub launched a new feature to sync a branch with upstream via the web UI. https://github.blog/changelog/2021-05-06-sync-an-out-of-date-branch-of-a-for... On Thu., May 6, 2021, 15:16 Ethan Furman, <ethan@stoneleaf.us> wrote:
participants (8)
-
Brett Cannon
-
Ethan Furman
-
Inada Naoki
-
Jelle Zijlstra
-
Mariatta
-
Nick Coghlan
-
Skip Montanaro
-
Stefan Ring