* Deleting remote branches with git-branch and reflog questions
@ 2007-01-23 12:59 Andy Parkins
2007-01-23 13:02 ` Andreas Ericsson
2007-01-23 13:12 ` Jakub Narebski
0 siblings, 2 replies; 16+ messages in thread
From: Andy Parkins @ 2007-01-23 12:59 UTC (permalink / raw)
To: git
Hello,
As per subject.
If anything, these are safer to delete than local branches because they will
be restored automatically with the next fetch, so why do we require the extra
switch for remote branches?
Would it be simpler for the user if the following worked?
$ git branch -a
* master
origin/master
$ git branch -D origin/master
i.e. that the -r switch was unnecessary in unambiguous cases.
reflogs
-------
Why does the reflog directory .git/logs need to store the refs/ directory?
Aren't /all/ the refs under "refs/" these days?
Is it right that the reflog for a branch is deleted when the branch is
deleted? Doesn't this kill one of the advantages of reflogs? In particular,
if I accidentally deleted a branch, I would have no way of getting it back
because the reflog has been deleted too? Personally I'd prefer that a reflog
line was added saying
XXXXXXXXXXXXXXX 00000000000000 Deleted
Or similar. After all; it's only disk space. If the ref was later created
again, then the log can continue to be added to, but it will have a "Created
from" in the middle instead of at the end.
Andy
--
Dr Andy Parkins, M Eng (hons), MIEE
andyparkins@gmail.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 12:59 Deleting remote branches with git-branch and reflog questions Andy Parkins
@ 2007-01-23 13:02 ` Andreas Ericsson
2007-01-23 13:14 ` Andy Parkins
2007-01-23 13:12 ` Jakub Narebski
1 sibling, 1 reply; 16+ messages in thread
From: Andreas Ericsson @ 2007-01-23 13:02 UTC (permalink / raw)
To: Andy Parkins; +Cc: git
Andy Parkins wrote:
>
> reflogs
> -------
>
> Why does the reflog directory .git/logs need to store the refs/ directory?
> Aren't /all/ the refs under "refs/" these days?
>
No. HEAD isn't, nor is ORIG_HEAD, and possibly others.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 13:02 ` Andreas Ericsson
@ 2007-01-23 13:14 ` Andy Parkins
2007-01-23 21:25 ` Junio C Hamano
0 siblings, 1 reply; 16+ messages in thread
From: Andy Parkins @ 2007-01-23 13:14 UTC (permalink / raw)
To: git; +Cc: Andreas Ericsson
On Tuesday 2007 January 23 13:02, Andreas Ericsson wrote:
> > Why does the reflog directory .git/logs need to store the refs/
> > directory? Aren't /all/ the refs under "refs/" these days?
>
> No. HEAD isn't, nor is ORIG_HEAD, and possibly others.
They're all special cases aren't they? They are symrefs. I don't think they
are reflogged at all (they certainly don't appear in my .git/logs directory.
Perhaps I should rephrase... aren't /all/ the logged refs under "refs/" these
days?
Andy
--
Dr Andy Parkins, M Eng (hons), MIEE
andyparkins@gmail.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 13:14 ` Andy Parkins
@ 2007-01-23 21:25 ` Junio C Hamano
2007-01-23 21:35 ` Johannes Schindelin
2007-01-23 21:52 ` Nicolas Pitre
0 siblings, 2 replies; 16+ messages in thread
From: Junio C Hamano @ 2007-01-23 21:25 UTC (permalink / raw)
To: Andy Parkins; +Cc: git
Andy Parkins <andyparkins@gmail.com> writes:
> Aren't /all/ the logged refs under "refs/" these
> days?
Yes, so what. It's not a big deal, and it's too late to change,
isn't it?
Seriously, I think with addition of 'git log --walk-reflogs' and
'git show-branch --reflog', there is less reason for an end user
to look at the raw .git/logs/ directory these days. They might
not fully expose the information recorded in reflog yet, but I
think what they do show is useful and adequate. If some useful
information is lacking from their output, we should solve that
by enhancing them, not by moving .git/logs/refs up one level to
save the end user five keystrokes to allow him to run less head
or tail on ".git/logs/heads/master".
And we might want to allow reflogs on detached HEAD someday,
although I personally think it goes against what detached HEAD
is -- it is of a very temporary nature.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 21:25 ` Junio C Hamano
@ 2007-01-23 21:35 ` Johannes Schindelin
2007-01-23 21:52 ` Nicolas Pitre
1 sibling, 0 replies; 16+ messages in thread
From: Johannes Schindelin @ 2007-01-23 21:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Andy Parkins, git
Hi,
On Tue, 23 Jan 2007, Junio C Hamano wrote:
> Andy Parkins <andyparkins@gmail.com> writes:
>
> > Aren't /all/ the logged refs under "refs/" these
> > days?
>
> Yes, so what. It's not a big deal, and it's too late to change,
> isn't it?
>
> Seriously, I think with addition of 'git log --walk-reflogs' and
> 'git show-branch --reflog', there is less reason for an end user
> to look at the raw .git/logs/ directory these days.
How about introducing the shortcut "-g" for "--walk-reflogs"? It is not
yet taken AFAICT.
> And we might want to allow reflogs on detached HEAD someday, although I
> personally think it goes against what detached HEAD is -- it is of a
> very temporary nature.
But so are reflogs. They go away after some time.
Disk space is cheap.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 21:25 ` Junio C Hamano
2007-01-23 21:35 ` Johannes Schindelin
@ 2007-01-23 21:52 ` Nicolas Pitre
2007-01-23 22:06 ` Johannes Schindelin
2007-01-24 1:46 ` Junio C Hamano
1 sibling, 2 replies; 16+ messages in thread
From: Nicolas Pitre @ 2007-01-23 21:52 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Andy Parkins, git
On Tue, 23 Jan 2007, Junio C Hamano wrote:
> And we might want to allow reflogs on detached HEAD someday,
> although I personally think it goes against what detached HEAD
> is -- it is of a very temporary nature.
Didn't we agree already that reflog with detached head was simply
insane?
Nicolas
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 21:52 ` Nicolas Pitre
@ 2007-01-23 22:06 ` Johannes Schindelin
2007-01-24 1:46 ` Junio C Hamano
1 sibling, 0 replies; 16+ messages in thread
From: Johannes Schindelin @ 2007-01-23 22:06 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Junio C Hamano, git
Hi,
On Tue, 23 Jan 2007, Nicolas Pitre wrote:
> On Tue, 23 Jan 2007, Junio C Hamano wrote:
>
> > And we might want to allow reflogs on detached HEAD someday,
> > although I personally think it goes against what detached HEAD
> > is -- it is of a very temporary nature.
>
> Didn't we agree already that reflog with detached head was simply
> insane?
Maybe you did. I did not agree on that.
Also I have yet to see a valid reason against tracking HEAD.
(Yes, it is better to think about that first, be restrictive, and if it
turns out to make sense, allow that -- rather than allow it, decide that
it does not make sense, and then forbid it.)
Ciao,
Dscho
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 21:52 ` Nicolas Pitre
2007-01-23 22:06 ` Johannes Schindelin
@ 2007-01-24 1:46 ` Junio C Hamano
2007-01-24 2:12 ` Nicolas Pitre
1 sibling, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2007-01-24 1:46 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: git
Nicolas Pitre <nico@cam.org> writes:
> On Tue, 23 Jan 2007, Junio C Hamano wrote:
>
>> And we might want to allow reflogs on detached HEAD someday,
>> although I personally think it goes against what detached HEAD
>> is -- it is of a very temporary nature.
>
> Didn't we agree already that reflog with detached head was simply
> insane?
Perhaps, perhaps not.
$ git checkout v2.6.14
$ git checkout v2.6.15
$ git checkout v2.6.16
Ah, which one did I check-out the last time?
$ git describe HEAD@{1}
I suspect that we could re-implement "git bisect" without using
the special "bisect" branch (we would still be using refs/bisect
namespace).
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: Deleting remote branches with git-branch and reflog questions
2007-01-24 1:46 ` Junio C Hamano
@ 2007-01-24 2:12 ` Nicolas Pitre
2007-01-24 2:22 ` Jakub Narebski
2007-01-24 9:58 ` Johannes Schindelin
0 siblings, 2 replies; 16+ messages in thread
From: Nicolas Pitre @ 2007-01-24 2:12 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Tue, 23 Jan 2007, Junio C Hamano wrote:
> Nicolas Pitre <nico@cam.org> writes:
>
> > On Tue, 23 Jan 2007, Junio C Hamano wrote:
> >
> >> And we might want to allow reflogs on detached HEAD someday,
> >> although I personally think it goes against what detached HEAD
> >> is -- it is of a very temporary nature.
> >
> > Didn't we agree already that reflog with detached head was simply
> > insane?
>
> Perhaps, perhaps not.
>
> $ git checkout v2.6.14
> $ git checkout v2.6.15
> $ git checkout v2.6.16
>
> Ah, which one did I check-out the last time?
>
> $ git describe HEAD@{1}
And what does HEAD@{1} means if not detached?
If there is a reflog for HEAD independently of what branch HEAD is
attached to then it could make sense. Meaning that if you're on branch
"master" and perform a commit, then both reflogs for "master" and "HEAD"
are updated at the same time. If you then checkout branch "next" then
only the "HEAD" reflog is updated since no changes to any branch did
occur but just HEAD changed.
Then moving around and/or committing with a detached head would just
update the "HEAD reflog.
Nicolas
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: Deleting remote branches with git-branch and reflog questions
2007-01-24 2:12 ` Nicolas Pitre
@ 2007-01-24 2:22 ` Jakub Narebski
2007-01-24 3:18 ` Nicolas Pitre
2007-01-24 9:58 ` Johannes Schindelin
1 sibling, 1 reply; 16+ messages in thread
From: Jakub Narebski @ 2007-01-24 2:22 UTC (permalink / raw)
To: git
Nicolas Pitre wrote:
> On Tue, 23 Jan 2007, Junio C Hamano wrote:
>
>> Nicolas Pitre <nico@cam.org> writes:
>>
>>> On Tue, 23 Jan 2007, Junio C Hamano wrote:
>>>
>>>> And we might want to allow reflogs on detached HEAD someday,
>>>> although I personally think it goes against what detached HEAD
>>>> is -- it is of a very temporary nature.
>>>
>>> Didn't we agree already that reflog with detached head was simply
>>> insane?
>>
>> Perhaps, perhaps not.
>>
>> $ git checkout v2.6.14
>> $ git checkout v2.6.15
>> $ git checkout v2.6.16
>>
>> Ah, which one did I check-out the last time?
>>
>> $ git describe HEAD@{1}
>
> And what does HEAD@{1} means if not detached?
>
> If there is a reflog for HEAD independently of what branch HEAD is
> attached to then it could make sense. Meaning that if you're on branch
> "master" and perform a commit, then both reflogs for "master" and "HEAD"
> are updated at the same time. If you then checkout branch "next" then
> only the "HEAD" reflog is updated since no changes to any branch did
> occur but just HEAD changed.
>
> Then moving around and/or committing with a detached head would just
> update the "HEAD reflog.
I think it would be best to maintain mixed approach. When we are on some
branch, the HEAD@{1} would mean <current branch>@{1}. When HEAD is detached
(is not symlink or symref), HEAD@{1} means it's latest state. Detaching
a head creates reflog, de-detaching deletes it...
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: Deleting remote branches with git-branch and reflog questions
2007-01-24 2:22 ` Jakub Narebski
@ 2007-01-24 3:18 ` Nicolas Pitre
0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Pitre @ 2007-01-24 3:18 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
[ please CC me when replying, please ]
On Wed, 24 Jan 2007, Jakub Narebski wrote:
> Nicolas Pitre wrote:
>
> > On Tue, 23 Jan 2007, Junio C Hamano wrote:
> >
> >> Nicolas Pitre <nico@cam.org> writes:
> >>
> >>> On Tue, 23 Jan 2007, Junio C Hamano wrote:
> >>>
> >>>> And we might want to allow reflogs on detached HEAD someday,
> >>>> although I personally think it goes against what detached HEAD
> >>>> is -- it is of a very temporary nature.
> >>>
> >>> Didn't we agree already that reflog with detached head was simply
> >>> insane?
> >>
> >> Perhaps, perhaps not.
> >>
> >> $ git checkout v2.6.14
> >> $ git checkout v2.6.15
> >> $ git checkout v2.6.16
> >>
> >> Ah, which one did I check-out the last time?
> >>
> >> $ git describe HEAD@{1}
> >
> > And what does HEAD@{1} means if not detached?
> >
> > If there is a reflog for HEAD independently of what branch HEAD is
> > attached to then it could make sense. Meaning that if you're on branch
> > "master" and perform a commit, then both reflogs for "master" and "HEAD"
> > are updated at the same time. If you then checkout branch "next" then
> > only the "HEAD" reflog is updated since no changes to any branch did
> > occur but just HEAD changed.
> >
> > Then moving around and/or committing with a detached head would just
> > update the "HEAD reflog.
>
> I think it would be best to maintain mixed approach. When we are on some
> branch, the HEAD@{1} would mean <current branch>@{1}. When HEAD is detached
> (is not symlink or symref), HEAD@{1} means it's latest state. Detaching
> a head creates reflog, de-detaching deletes it...
Please no. I think this is exactly the absolutely worst thing you could
have. Better not have any reflog for detached heads at all.
First, if you're not playing with detached heads then you don't care
since it makes no difference.
But if you do use a detached head then having HEAD@{n} suddenly change
from one universe to another just because you detached or attached HEAD
from/to a branch is insane.
Consider HEAD@{1} when you just detached from a branch? According to
your suggestion it would point into the void.
And why wouldn't HEAD@{1} refer back to a detached state right after
checking out a branch? According to your suggestion the last detached
position is now lost. Worse, it will point to a commit which might have
nothing to do with the previous operation I performed with my repository
which is IMHO against the spirit of a reflog for "HEAD".
Nicolas
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-24 2:12 ` Nicolas Pitre
2007-01-24 2:22 ` Jakub Narebski
@ 2007-01-24 9:58 ` Johannes Schindelin
1 sibling, 0 replies; 16+ messages in thread
From: Johannes Schindelin @ 2007-01-24 9:58 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Junio C Hamano, git
Hi,
On Tue, 23 Jan 2007, Nicolas Pitre wrote:
> On Tue, 23 Jan 2007, Junio C Hamano wrote:
>
> > Nicolas Pitre <nico@cam.org> writes:
> >
> > > On Tue, 23 Jan 2007, Junio C Hamano wrote:
> > >
> > >> And we might want to allow reflogs on detached HEAD someday,
> > >> although I personally think it goes against what detached HEAD
> > >> is -- it is of a very temporary nature.
> > >
> > > Didn't we agree already that reflog with detached head was simply
> > > insane?
> >
> > Perhaps, perhaps not.
> >
> > $ git checkout v2.6.14
> > $ git checkout v2.6.15
> > $ git checkout v2.6.16
> >
> > Ah, which one did I check-out the last time?
> >
> > $ git describe HEAD@{1}
>
> And what does HEAD@{1} means if not detached?
>
> If there is a reflog for HEAD independently of what branch HEAD is
> attached to then it could make sense. Meaning that if you're on branch
> "master" and perform a commit, then both reflogs for "master" and "HEAD"
> are updated at the same time. If you then checkout branch "next" then
> only the "HEAD" reflog is updated since no changes to any branch did
> occur but just HEAD changed.
>
> Then moving around and/or committing with a detached head would just
> update the "HEAD reflog.
This would also be my idea. I agree with you that mixing approaches like
Jakub proposed is insane.
But given the idea of reflogs ("Where was this yesterday"), I think it
would make sense to reflog HEAD -- independent on which branch it happens
to refer to.
Warning! It _changes_ the behaviour. As of now, "git log --walk-reflogs
HEAD" shows the local view of the _branch_ that HEAD points to
_currently_. But I think that the current is difficult to explain to new
users, whereas the "jumping HEAD" is not.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 12:59 Deleting remote branches with git-branch and reflog questions Andy Parkins
2007-01-23 13:02 ` Andreas Ericsson
@ 2007-01-23 13:12 ` Jakub Narebski
2007-01-23 14:32 ` Andy Parkins
1 sibling, 1 reply; 16+ messages in thread
From: Jakub Narebski @ 2007-01-23 13:12 UTC (permalink / raw)
To: git
Andy Parkins wrote:
> reflogs
> -------
>
> Why does the reflog directory .git/logs need to store the refs/ directory?
> Aren't /all/ the refs under "refs/" these days?
HEAD is not under refs/. Although IIRC we don't reflog HEAD, with detached
HEAD we could reflog at least detached state.
> Is it right that the reflog for a branch is deleted when the branch is
> deleted? Doesn't this kill one of the advantages of reflogs? In particular,
> if I accidentally deleted a branch, I would have no way of getting it back
> because the reflog has been deleted too? Personally I'd prefer that a reflog
> line was added saying
> XXXXXXXXXXXXXXX 00000000000000 Deleted
> Or similar. After all; it's only disk space. If the ref was later created
> again, then the log can continue to be added to, but it will have a "Created
> from" in the middle instead of at the end.
The problem is when you delete branch 'foo', and then create branch
'foo/bar'. You can't have both 'foo' and 'foo/bar' reflog.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 13:12 ` Jakub Narebski
@ 2007-01-23 14:32 ` Andy Parkins
2007-01-23 14:59 ` Johannes Schindelin
0 siblings, 1 reply; 16+ messages in thread
From: Andy Parkins @ 2007-01-23 14:32 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
On Tuesday 2007 January 23 13:12, Jakub Narebski wrote:
> The problem is when you delete branch 'foo', and then create branch
> 'foo/bar'. You can't have both 'foo' and 'foo/bar' reflog.
Ah; yes of course. That is a bit of a deal breaker isn't it?
On the other hand, why delete it instantly? Since the reflog is currently
deleted by git-branch anyway, couldn't the deletion be delayed until the
creation of foo/bar? At least then the deletion only hits if it really has
to. In most circumstances foo then foo/bar is fairly unlikely.
Andy
--
Dr Andy Parkins, M Eng (hons), MIEE
andyparkins@gmail.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 14:32 ` Andy Parkins
@ 2007-01-23 14:59 ` Johannes Schindelin
2007-01-23 15:29 ` Andy Parkins
0 siblings, 1 reply; 16+ messages in thread
From: Johannes Schindelin @ 2007-01-23 14:59 UTC (permalink / raw)
To: Andy Parkins; +Cc: git, Jakub Narebski
Hi,
On Tue, 23 Jan 2007, Andy Parkins wrote:
> On Tuesday 2007 January 23 13:12, Jakub Narebski wrote:
>
> > The problem is when you delete branch 'foo', and then create branch
> > 'foo/bar'. You can't have both 'foo' and 'foo/bar' reflog.
>
> Ah; yes of course. That is a bit of a deal breaker isn't it?
>
> On the other hand, why delete it instantly?
You mean, kind of like a waste bin? Where you delete stuff, but come back
and whine that you did not meant to delete it after all?
:-))
Ciao,
Dscho
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Deleting remote branches with git-branch and reflog questions
2007-01-23 14:59 ` Johannes Schindelin
@ 2007-01-23 15:29 ` Andy Parkins
0 siblings, 0 replies; 16+ messages in thread
From: Andy Parkins @ 2007-01-23 15:29 UTC (permalink / raw)
To: git; +Cc: Johannes Schindelin, Jakub Narebski
On Tuesday 2007 January 23 14:59, Johannes Schindelin wrote:
> You mean, kind of like a waste bin? Where you delete stuff, but come back
> and whine that you did not meant to delete it after all?
No, no; I'm whining that the reflog was deleted, not the branch. I think
that "ref deleted" is just as valid for logging as anything else, and
deleting the log makes it impossible to view that operation.
Given how powerful the reflog is; it doesn't seem unreasonable to want to be
able to do
$ git branch -D some-branch
$ git show some-branch@{2 days ago}
Andy
--
Dr Andy Parkins, M Eng (hons), MIEE
andyparkins@gmail.com
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2007-01-24 9:58 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-23 12:59 Deleting remote branches with git-branch and reflog questions Andy Parkins
2007-01-23 13:02 ` Andreas Ericsson
2007-01-23 13:14 ` Andy Parkins
2007-01-23 21:25 ` Junio C Hamano
2007-01-23 21:35 ` Johannes Schindelin
2007-01-23 21:52 ` Nicolas Pitre
2007-01-23 22:06 ` Johannes Schindelin
2007-01-24 1:46 ` Junio C Hamano
2007-01-24 2:12 ` Nicolas Pitre
2007-01-24 2:22 ` Jakub Narebski
2007-01-24 3:18 ` Nicolas Pitre
2007-01-24 9:58 ` Johannes Schindelin
2007-01-23 13:12 ` Jakub Narebski
2007-01-23 14:32 ` Andy Parkins
2007-01-23 14:59 ` Johannes Schindelin
2007-01-23 15:29 ` Andy Parkins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).