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

Re: Question about 'branch -d' safety

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 18, 2010, 00:43 UTC
Message-ID
<20100718004347.GA8665@burratino>
In-Reply-To
<20100717093006.GA11452@localhost>
Clemens Buchacher wrote:
> I am not sure how to proceed with this.
Maybe: try out the patch locally for a while.  Such an experiment
would make it easier to see whether this feature because indispensible
and how the details should be to work best in practice.

But be careful! Once you have learned to rely on the master@{before.deletion} facility, you might end up trigger-happy with ‘branch -d’ and get into trouble when faced with copies of git without the safety valve.

To respond to your philosophical points:
> + safety net

I consider it very good that git is willing to _lose_ information rather than get overloaded with it. On this laptop, if I try

 linux$ git fetch git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git
 linux$ git checkout FETCH_HEAD
        ... hack away ...

in a repository with quickly-expiring HEAD reflog, then the pack size stays barely comfortable. Perhaps a person that regularly builds short-lived topic branches off such an unstable branch would be similarly grateful that the objects do not need to stay long.

So: this aspect is a minus for me.
> + less dependant on git branch -d

I have not find “log -g” too useful for protection against fat-finger accidents (“fsck --lost-found” and “push” take care of that) so it seems odd to see safety touted as its main benefit. What the reflog and HEAD@{4} syntax prevent me from losing is a train of thought. After deleting a branch I have just merged, if I start to wonder about “that branch I just deleted”, reading reflog entries to find it is the last thing I want to be doing.

In other words, it is not enough that “branch -d” be safe. Yes, the old branch tip is an ancestor of origin/master, but that does not bring me much closer to finding it. To be able to refer to master@{5.minutes.ago} directly would be much more convenient.

+.
> + automatically prune remote tracking branches
I’m not comfortable with the idea yet.
0.
> - only a convenience
> - implementation complexity

Your implementation seemed simple. I don’t think implementation complexity is the fatal flaw.

0.
> - user interface complexity

Keeping the reflog would arguably make the syntax for specifying revisions more consistent.

On the other hand, there are some hard policy questions:
 * Should pre-deletion commits expire more quickly?
 * What happens when you rename one branch to take on the
   name of a deleted one?
 * What happens when you create a new branch to take the
   place of a deleted one?
 * Should refs outside the refs/heads/ namespace
   (like refs/bisect/ and refs/original/) use the same
   policy as refs/heads/?
0.
Previous: Clemens BuchacherNext: Jakub Narebski
Message 25 of 42 in “Question about 'branch -d' safety”
  1. Nanako ShiraishiDec 29, 2009
  2. Nicolas SebrechtDec 29, 2009
  3. Nanako ShiraishiDec 30, 2009
  4. Junio C HamanoDec 30, 2009
  5. Nicolas SebrechtDec 30, 2009
  6. Clemens BuchacherJul 10, 2010
  7. Jonathan NiederJul 10, 2010
  8. Jakub NarebskiJul 10, 2010
  9. Jonathan NiederJul 10, 2010
  10. Clemens BuchacherJul 11, 2010
  11. Jakub NarebskiJul 11, 2010
  12. Julian PhillipsJul 11, 2010
  13. Clemens BuchacherJul 11, 2010
  14. Junio C HamanoJul 11, 2010
  15. Jakub NarebskiJul 11, 2010
  16. Will PalmerJul 11, 2010
  17. Clemens BuchacherJul 12, 2010
  18. Junio C HamanoJul 12, 2010
  19. Clemens BuchacherJul 13, 2010
  20. Will PalmerJul 13, 2010
  21. Johannes SixtJul 13, 2010
  22. Will PalmerJul 13, 2010
  23. Clemens BuchacherJul 13, 2010
  24. Clemens BuchacherJul 17, 2010
  25. Jonathan NiederJul 18, 2010
  26. Jakub NarebskiJul 18, 2010
  27. Will PalmerJul 18, 2010
  28. Jakub NarebskiJul 18, 2010
  29. Will PalmerJul 19, 2010
  30. Jakub NarebskiJul 19, 2010
  31. Joshua JensenJul 19, 2010
  32. Clemens BuchacherJul 19, 2010
  33. Will PalmerJul 19, 2010
  34. Jakub NarebskiJul 19, 2010
  35. Joshua JensenJul 20, 2010
  36. Will PalmerJul 20, 2010
  37. Jakub NarebskiJul 19, 2010
  38. Junio C HamanoJul 19, 2010
  39. Clemens BuchacherJul 19, 2010
  40. Jakub NarebskiJul 19, 2010
  41. Ævar Arnfjörð BjarmasonJul 20, 2010
  42. Matthieu MoyJul 20, 2010

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.