git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC] git-branch: add options and tests for branch renaming

From
Shawn Pearce <spearce@spearce.org>
Date
Nov 28, 2006, 15:39 UTC
Message-ID
<20061128153904.GC28337@spearce.org>
In-Reply-To
<456C4FCE.6090306@shadowen.org>
Andy Whitcroft <apw@shadowen.org> wrote:
Show 9 quoted lines
> Ok, I have been feeling uneasy about rename and reflogs for a while now.
>  About removing reflogs too for that matter.
> 
> In my mind the ref log is about tracking what a ref points to.  So I
> want to be able to say "what was next, yesterday".  Do I care if its not
> there now?  Perhaps I want a rename to just put a rename from in the top
> of the new reflog and leave the old there.
> 
> Yep, no idea how we would clean them up with this model.  But ...

You use a global reflog instead of a ref specific log. There are of course huge problems with that idea, but it is probably the simplest way to solve what you want.

Though I'm not sure why you care that much. To me a ref is just as transient as the name of the working directory the repository is housed in. I could care less what I called that directory last week, just that it exists and has the content I expect. On the other hand, once I'm in that directory I *do* want the history of it. That's where git comes in. Likewise for a ref once I am speaking about a given ref, I want the history of it, and that's where git's reflog comes in.

Although I just realized this paticular case:
	git branch -D next
	git fetch origin next:next
	...
	git fetch origin next:next
	git branch -M next bob
	...
	... 2 days go by  ...
	...
	git fetch origin next:next
	... arrgh next is no good! ...
	git log next@{2.days.ago}

and there's nothing there, as the log for next just started in the last fetch. Yet you had a next that you renamed to bob, and that next has the log.

Though this can be easily dealt with by reading the RENAME_LOG. If you scan both this ref's log and the RENAME_LOG and switch to scanning another ref's log when you find that this ref was renamed to another ref, then you get what you expect above. Except if you deleted the rename destination branch.

I can't say I would use that feature though, despite how handy I find reflogs to be.

Previous: Andy WhitcroftNext: Lars Hjemli
Message 3 of 4 in “[RFC] git-branch: add options and tests for branch renaming”
  1. Lars HjemliNov 28, 2006
  2. Andy WhitcroftNov 28, 2006
  3. Shawn PearceNov 28, 2006
  4. Lars HjemliNov 28, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.