git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] git-ghost: preserve “why” on deleted lines
@ 2025-05-23 12:32 Max Rhodin
  2025-05-23 17:24 ` Junio C Hamano
  2025-05-23 19:45 ` Lucas Seiki Oshiro
  0 siblings, 2 replies; 3+ messages in thread
From: Max Rhodin @ 2025-05-23 12:32 UTC (permalink / raw)
  To: git

Hi,

I hate losing the why behind a deleted line.

When you drop code in a review, being able to attach a brief comment
to that line would save a lot of head-scratching.

Git-ghost – see the remnants of days past in a file.

git-ghost hooks into commit to stash deleted lines in a `.ghost` file
and enables maintainers to prompt for a short reason. Later you can run:

    git ghost view <file>

to see what vanished and why. Blame also becomes easier.

No core changes—pure userland. Repos can opt in or out. Also helps AI
agents make sense of code history.

Could be made in thousands of ways, but unless the deleted rows are saved
as actual file-bound information, understanding it later and building tools
for it is much harder. `git note` could be used, but doesn't really solve
the issue.

Comments?

Max Rhodin
max@ux.se

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] git-ghost: preserve “why” on deleted lines
  2025-05-23 12:32 [RFC] git-ghost: preserve “why” on deleted lines Max Rhodin
@ 2025-05-23 17:24 ` Junio C Hamano
  2025-05-23 19:45 ` Lucas Seiki Oshiro
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2025-05-23 17:24 UTC (permalink / raw)
  To: Max Rhodin; +Cc: git

Max Rhodin <max@ux.se> writes:

> Comments?

Would running "git blame" in reverse work for your use case?

Tracing deleted contents is much harder than tracing contents in the
current revision, simply because you have to find where to start
digging.  In order to find where the contents were removed, you
first need to know what exact contents you are looking for (which
by definition you cannot do with the current revision), and then you
need to know what revision had that code.

What I do in practice is to randomly check out an old revision to
find sufficiently old one that still contains the contents ("git
bisect" can help), and then go from there.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] git-ghost: preserve “why” on deleted lines
  2025-05-23 12:32 [RFC] git-ghost: preserve “why” on deleted lines Max Rhodin
  2025-05-23 17:24 ` Junio C Hamano
@ 2025-05-23 19:45 ` Lucas Seiki Oshiro
  1 sibling, 0 replies; 3+ messages in thread
From: Lucas Seiki Oshiro @ 2025-05-23 19:45 UTC (permalink / raw)
  To: Max Rhodin; +Cc: git


> Hi,

Hi, Max!

> I hate losing the why behind a deleted line.
> 
> When you drop code in a review, being able to attach a brief comment
> to that line would save a lot of head-scratching.

Sorry if I misunderstood you, but I can't see the difference of that
to committing empty lines + giving a meaningful commit message.

> Git-ghost – see the remnants of days past in a file.
> 
> git-ghost hooks into commit to stash deleted lines in a `.ghost` file
> and enables maintainers to prompt for a short reason. Later you can run:
> 
>    git ghost view <file>
> 
> to see what vanished and why. Blame also becomes easier.

I still don't see the difference of that to git log -- <file>. I
understand that git blame doesn't show what has been deleted, only what
is new and what has changed. But ok, git blame has it's limitations of
being a quick line-wise inspection tool, while more deeper analysis
would require more powerful tools. It looks to me that git log with
some flags would do what you need.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-23 19:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 12:32 [RFC] git-ghost: preserve “why” on deleted lines Max Rhodin
2025-05-23 17:24 ` Junio C Hamano
2025-05-23 19:45 ` Lucas Seiki Oshiro

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).