Git question

Steven Smith steve.t.smith at
Thu Jan 9 22:33:26 UTC 2020

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

> On Jan 9, 2020, at 16:34, Gerben Wierda <gerben.wierda at> wrote:
> Given my absolute lack of decent git skills (and it’s just too complicated for a fast skill increase) I have the following setup (which so far worked)
> I have a macports-ports clone on GitHub which I use locally. I need a clone or I cannot create pull requests.
> When I have to do a reset, I:
> - save my changed files outside the git tree
> - then:
> # To reset the current reporsitory to what is in upstream (my repo is called 'local', upstream is called 'origin')
>    git fetch origin
>    git reset --hard origin/master
> # I push the local store to my cloned repository on github:
>    git push
> After this, my repo on (gctwnl/macports-ports) and my local copy of my own repo are in sync with macports/macports-ports
> Or so I thought. But I just tried this and I get:
> albus:macports-ports sysbh$ git push
> Username for '': gerben.wierda at                             
> Password for '': 
> To
>  ! [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.
> So, apparently my ‘reboot’ isn’t hard enough. What went wrong? How do I
> - reset my clone (both local and on to the current HEAD of the official repo in a way that always works?
> G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3898 bytes
Desc: not available
URL: <>

More information about the macports-users mailing list