Maintaining my own branch with git

Steve O'Hara-Smith steve at sohara.org
Thu Apr 29 12:16:56 UTC 2021


On Thu, 29 Apr 2021 14:10:55 +0200
Andrea Venturoli <ml at netfence.it> wrote:

> On 4/28/21 2:16 PM, Steve O'Hara-Smith wrote:
> 
> > 6: Update myworkingbranch with:
> >     git rebase main
> >     NB: This will stash your changes, bring in the updates and then
> > reapply your changes, requiring you to sort out any conflicts that come
> > up. 7: After this rebase you will need to force push myworkingbranch to
> >     your server
> 
> When I try this, I get:
> > % git push
> > To ssh://...
> >  ! [rejected]                  netfence_main -> netfence_main
> > (non-fast-forward) error: failed to push some refs to 'ssh://...'
> > 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.
> 
> Should I pull or push with "-f"?

	Yes you should. What is happening is that when you rebase against
main you rewrite the history of your changes (they are based against a
different commit to those on your server) so you have to use force to get
the server to accept the rewrite of history.

-- 
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:\>WIN                                     | A better way to focus the sun
The computer obeys and wins.                |    licences available see
You lose and Bill collects.                 |    http://www.sohara.org/


More information about the freebsd-questions mailing list