Git question

Gerben Wierda gerben.wierda at
Fri Jan 10 09:34:07 UTC 2020

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 (fetch)
local (push)
origin (fetch)
origin (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 '': gerben.wierda at
Password for '': 
 ! [rejected]                master -> master (non-fast-forward)
error: failed to push some refs to ''
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??


> On 10 Jan 2020, at 08:57, Michael <keybounce at> wrote:
> On 2020-01-09, at 2:33 PM, Steven Smith <steve.t.smith at <mailto:steve.t.smith at>> wrote:
>> Me too. We’re discussing MacPorts-relevant git commands in <> .
>> 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 ...
> <>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-users mailing list