public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: Duy Nguyen <pclouds@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: On undoing a forced push
Date: Tue, 09 Jun 2015 15:17:10 +0200	[thread overview]
Message-ID: <vpqtwuh6my1.fsf@anie.imag.fr> (raw)
In-Reply-To: <20150609121221.GA14126@lanh> (Duy Nguyen's message of "Tue, 9 Jun 2015 19:12:21 +0700")

Duy Nguyen <pclouds@gmail•com> writes:

> From a thread on Hacker News. It seems that if a user does not have
> access to the remote's reflog and accidentally forces a push to a ref,
> how does he recover it? In order to force push again to revert it
> back, he would need to know the remote's old SHA-1. Local reflog does
> not help because remote refs are not updated during a push.

More precisely, the remote-tracking ref is updated, and so is its
reflog, but the reflog entry usually does not help, because it documents
the old and new sha1 of the remote-tracking ref, not of the remote ref
itself. Typically, if a coworker pushed some code that I did not pull,
and I force-push to the same branch, my reflog won't have the sha1 of my
coworker's code.

> This patch prints the latest SHA-1 before the forced push in full.

Sounds like a good idea to me.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  reply	other threads:[~2015-06-09 13:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 12:12 On undoing a forced push Duy Nguyen
2015-06-09 13:17 ` Matthieu Moy [this message]
2015-06-09 14:06 ` Sitaram Chamarty
2015-06-09 14:25   ` Jeff King
2015-06-09 14:50     ` Sitaram Chamarty
2015-06-09 16:29   ` Johannes Schindelin
2015-06-09 16:55     ` Stefan Beller
2015-06-09 23:24     ` Duy Nguyen
2015-06-09 15:00 ` brian m. carlson
2015-06-10  2:43   ` Duy Nguyen
2015-06-10 12:18     ` brian m. carlson

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=vpqtwuh6my1.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp$(echo .)fr \
    --cc=git@vger$(echo .)kernel.org \
    --cc=pclouds@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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