OK. I'm back in git hell (suggestions made on this list, tips on stackexchange, git documentation, nothing gives me the answer)
I have albus:macports-ports sysbh$ git remote -v local https://github.com/gctwnl/macports-ports.git (fetch) local https://github.com/gctwnl/macports-ports.git (push) origin https://github.com/macports/macports-ports.git (fetch) origin https://github.com/macports/macports-ports.git (push) So, my clone is ‘local’, the upstream repository is ‘origin’ (some instructions tend to call this ‘upstream’, others ‘origin’, there seem to be two ’sops’ on this in gitland. I think now that using ‘upstream’ is the better choice as git defaults to ‘origin’ when no argument is given. So, I need to rename too. But first let’s see if I can get this thing working in the first place). If I produce a pull request and I’m rebuffed because of an error I make, I need to go back to testate of the official repository before proceeding again. At such a point my own clone is both commits ahead and commits behind the official repository. I need to lose my commits (as I am rebuffed by macports maintainers if I have multiple ‘working’ commits in my pull request). So, I need to reset my clone to the current state of the official repository. So, my clone is now two commits ahead of the official macports repository and 343 commits behind. I need to reset my clone to be the same as the official repository. The result of which is: albus:macports-ports sysbh$ git fetch origin albus:macports-ports sysbh$ git reset --hard origin/master HEAD is now at dfb14de3eb5 pypy*-tkinter: ensure UsingTheRightCompiler albus:macports-ports sysbh$ git push Username for 'https://github.com': [email protected] Password for 'https://[email protected]@github.com': To https://github.com/gctwnl/macports-ports.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/gctwnl/macports-ports.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 don’t want to “Integrate the remote changes”, I want to lose them. How?? G > On 10 Jan 2020, at 08:57, Michael <[email protected]> wrote: > > > On 2020-01-09, at 2:33 PM, Steven Smith <[email protected] > <mailto:[email protected]>> wrote: > >> Me too. We’re discussing MacPorts-relevant git commands in >> https://github.com/macports/macports-ports/pull/6106 >> <https://github.com/macports/macports-ports/pull/6106> . >> >> Easiest, most destructive to local: >> >> # save all local files changed outside the git repo >> >> git fetch --all >> git reset --hard upstream/master >> >> # restore all local files > > I'm sorry, I just have to follow up with this xkcd ... > > https://xkcd.com/1597/ <https://xkcd.com/1597/> >
