Git development
 help / color / mirror / Atom feed
From: Kevin Daudt <me@ikke.info>
To: Jeffrey Walton <noloader@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: How to force a push to succeed?
Date: Wed, 23 Aug 2017 10:03:28 +0200	[thread overview]
Message-ID: <20170823080328.GE3839@alpha.vpn.ikke.info> (raw)
In-Reply-To: <CAH8yC8=A0-geqduTNNJw0yb1BREqsB75_bKSp+06Rb5fY6oiuQ@mail.gmail.com>

On Tue, Aug 22, 2017 at 05:55:25PM -0400, Jeffrey Walton wrote:
> I tested some changes that lead to a dead end. The changes need to be
> removed. The changes were added in 7 commits.
> 
> I went back in time to the point before the changes:
> 
>     $ git reset --hard HEAD~7
>     HEAD is now at 559fc3b Fix benchmark selection code (GH #464)
> 
> When I attempted to push:
> 
>     $ git push
>     Username for 'https://github.com': noloader
>     To https://github.com/noloader/cryptopp.git
>      ! [rejected]        master -> master (non-fast-forward)
> 
> I tried to commit, but Git claims there's nothing to add:
> 
>     $ git commit
>     On branch master
>     Your branch is behind 'origin/master' by 7 commits, and can be
> fast-forwarded.
> 
> Commit seems to be the wrong command as Git appears to be trying to do
> something I don't want.
> 
> How do I force the push to succeed?
> 
> Thanks in advance.

By actually doing a force push:

    git push --force-with-lease origin master

But note that this can interfere with others working on the same
repository, so be carefull when you use a force push.

Additionally, I can recommend using separate branches for things that
might turn up as dead ends (or even for every development). That way,
you can just throw away the branch if you want to discard it.

Hope this helps, Kevin.



      parent reply	other threads:[~2017-08-23  8:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 21:55 How to force a push to succeed? Jeffrey Walton
2017-08-22 21:57 ` Stefan Beller
2017-08-22 22:03   ` Jeffrey Walton
2017-08-22 22:10     ` Jeffrey Walton
2017-08-22 22:26       ` Jeffrey Walton
2017-08-23 17:06         ` Johannes Sixt
2017-08-23 16:56       ` Jonathan Nieder
2017-08-23  8:03 ` Kevin Daudt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170823080328.GE3839@alpha.vpn.ikke.info \
    --to=me@ikke.info \
    --cc=git@vger.kernel.org \
    --cc=noloader@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox