Re: On undoing a forced push

2015-06-10 Thread brian m. carlson
On Wed, Jun 10, 2015 at 09:43:34AM +0700, Duy Nguyen wrote: On Tue, Jun 9, 2015 at 10:00 PM, brian m. carlson sand...@crustytoothpaste.net wrote: You've increased this by 20, but you're adding 40 characters to the strcpy. Are you sure that's enough? Also, you might consider writing this

Re: On undoing a forced push

2015-06-09 Thread Sitaram Chamarty
On 06/09/2015 05:42 PM, Duy Nguyen wrote: 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

Re: On undoing a forced push

2015-06-09 Thread Sitaram Chamarty
On 06/09/2015 07:55 PM, Jeff King wrote: On Tue, Jun 09, 2015 at 07:36:20PM +0530, Sitaram Chamarty wrote: This patch prints the latest SHA-1 before the forced push in full. He then can do git push remote +old-sha1:ref He does not even need to have the objects that old-sha1 refers

Re: On undoing a forced push

2015-06-09 Thread brian m. carlson
On Tue, Jun 09, 2015 at 07:12:21PM +0700, Duy Nguyen wrote: diff --git a/transport.c b/transport.c index f080e93..6bd6a64 100644 --- a/transport.c +++ b/transport.c @@ -657,16 +657,17 @@ static void print_ok_ref_status(struct ref *ref, int porcelain) [new branch]),

Re: On undoing a forced push

2015-06-09 Thread Jeff King
On Tue, Jun 09, 2015 at 07:36:20PM +0530, Sitaram Chamarty wrote: This patch prints the latest SHA-1 before the forced push in full. He then can do git push remote +old-sha1:ref He does not even need to have the objects that old-sha1 refers to. We could simply push an empty

Re: On undoing a forced push

2015-06-09 Thread Johannes Schindelin
Hi, On 2015-06-09 16:06, Sitaram Chamarty wrote: On 06/09/2015 05:42 PM, Duy Nguyen wrote: 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

Re: On undoing a forced push

2015-06-09 Thread Stefan Beller
On Tue, Jun 9, 2015 at 9:29 AM, Johannes Schindelin johannes.schinde...@gmx.de wrote: Hi, On 2015-06-09 16:06, Sitaram Chamarty wrote: On 06/09/2015 05:42 PM, Duy Nguyen wrote: From a thread on Hacker News. It seems that if a user does not have access to the remote's reflog and accidentally

Re: On undoing a forced push

2015-06-09 Thread Duy Nguyen
On Tue, Jun 9, 2015 at 11:29 PM, Johannes Schindelin johannes.schinde...@gmx.de wrote: Sorry to chime in so late in the discussion, but I think that the `--force-with-lease` option is what you are looking for. It allows you to force-push *but only* if the forced push would overwrite the ref

On undoing a forced push

2015-06-09 Thread Duy Nguyen
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

Re: On undoing a forced push

2015-06-09 Thread Duy Nguyen
On Tue, Jun 9, 2015 at 10:00 PM, brian m. carlson sand...@crustytoothpaste.net wrote: On Tue, Jun 09, 2015 at 07:12:21PM +0700, Duy Nguyen wrote: diff --git a/transport.c b/transport.c index f080e93..6bd6a64 100644 --- a/transport.c +++ b/transport.c @@ -657,16 +657,17 @@ static void

Re: On undoing a forced push

2015-06-09 Thread Matthieu Moy
Duy Nguyen pclo...@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.