Skip to content

Out of sync? #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Conversation

abekornelis
Copy link
Contributor

@abekornelis abekornelis commented Jul 4, 2025

I don't understand what may have caused this, but github claims my fork is 'ahead by 3 commits'
That's nonsense - those commits were merged into main by means of a PR over the last weeks.
Since github insists I create a PR I am doing so. Please merge or discard. My alternative is to kill my fork and create a new one. Sorry for the hassle and thanks for your patience.

@pryrt
Copy link
Contributor

pryrt commented Jul 4, 2025

I can confirm, based on the fact that this PR doesn't change any files, but just changes commit history, that your fork really does match this repo... and we don't do PR that just adds the extra commit history that is present in some fork, so this PR will be closed.

Best practice to avoid this in the future: After you make a fork, especially if you are planning to do more than one submission to the repo at some point:

  • GitHub interface to Sync Fork > Update branch action to make sure your fork is up-to-date (it might say This branch is not behind the upstream if your fork is up-to-date already)
  • Create a new branch for any changes
  • Submit PR from the branch
  • After PR is accepted, delete that branch
  • After PR is accepted, go to your fork's master branch, then use GitHub interface to Sync Fork > Update branch action to make sure your fork is up-to-date with the changes -- this method does it without adding a new commit to your fork, so you aren't instantly "1 commit ahead of" the primary upstream repo. (Sometimes, the way that the PR is merged will cause your repo to claim to be "N commits behind", even though the contents are the same. Doing this Sync Fork > Update branch can sometimes eliminate that.)

My alternative is to kill my fork and create a new one.

If you are still out-of-sync after the above procedure (or to get back in sync if you haven't followed that procedure), you have a couple of options:

  • If you have a git command-line client, or know how to make your computer's GUI git client implement the equivalent to the command-line commands, my recommendation is:
    1. check git remote -v, which will show something like:
      origin  git@github.com:pryrt/userDefinedLanguages.git (fetch)
      origin  git@github.com:pryrt/userDefinedLanguages.git (push)
      upstream        git@github.com:notepad-plus-plus/userDefinedLanguages.git (fetch)
      upstream        git@github.com:notepad-plus-plus/userDefinedLanguages.git (push)
      
      • If you have the origin entries but not the upstream entries, git remote add upstream git@github.com:notepad-plus-plus/userDefinedLanguages.git to add the upstream entry. (If you use https://... URLs instead of the SSH-based URLs, you can use that, instead). After this, git remote -v should show both.
    2. use git checkout master to make sure you're not in one of your branches
    3. use git pull to make sure that your local computer's clone is up-to-date with your GitHub fork
    4. use git fetch upstream to make sure that your local computer's clone knows the most recent from upstream
    5. use git reset --hard upstream/master to make your clone identical to the upstream
    6. use git push origin master --force to force git to put the reset copy back up to your GitHub fork
    7. At this point, if you refresh your browser at your fork's webpage, it should say it's in sync rather than "N ahead / M behind" or similar
  • If all you use is the GitHub interface, not a local clone on your computer, then, unforunately, deleting your fork and creating a new one is the only way I know how to get back into sync at this point. Sorry.

edit: finished a sentence in step 7; added an intro paragraph; PR will be closed

@pryrt pryrt added the rejected Will be closed without incorporating label Jul 4, 2025
@pryrt pryrt closed this Jul 4, 2025
@abekornelis
Copy link
Contributor Author

Hi Peter, thanks for the extensive help info. I ended up deleting my fork and create a new one. No problem you rejected the PR - I'd quite expected that. Thanks again for your support!
Kind regards,
Abe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rejected Will be closed without incorporating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants