1

I have a fork of microsoft/vscode-arduino on github. Some time ago I submitted a PR that was accepted. Time passed and now I want to do some more work.

At the time my use of git and github weren't very sophisticated and I rather foolishly did all the work on master.

On my local repo I pulled from upstream master, merged and committed to my fork, and was surprised to find that github thinks my fork is still 7 commits ahead and 113 behind.

Then I tried to rebase on the upstream as described on this page My pull request has been merged, what to do next? but the command

git pull --rebase origin master

and after a bit of mucking about I'm no commits behind and 12 commits ahead.

I really don't care about preserving anything. Everything important has long since been merged into the upstream repo. I just want to make this main exactly the same as current main in the upstream, so I can branch for my new efforts fixing an ongoing problem where every time there's a release of VS Code that uses a different version of node it breaks the serial port native integration until the Arduino extension is updated to the same release of Node and released.

Can anyone advise on how to do that? (discard the 12 commits ahead, not the N-API thing)

Peter Wone
  • 17,965
  • 12
  • 82
  • 134
  • You can validate the `origin` and the `upstream` using `git remote show upstream` or `origin`. – Maroun Sep 14 '20 at 06:21

1 Answers1

0

This may not be the most elegant but it worked.

  1. Use GitLens in VS Code to find the oldest commit that isn't mine and do a hard reset to that.
  2. In the terminal pane, git push --force. Refreshing the github page it now says I'm two commits behind origin (the repo I forked). I'm rid of the unwanted commits. Now to work forward.
  3. In VS Code terminal pane git pull --rebase upstream master
  4. In VS Code click on the status bar to sync.
  5. Refresh the github web page. Hooray, This branch is even with microsoft:master.
Peter Wone
  • 17,965
  • 12
  • 82
  • 134