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

Re: Git re-creates newly added directory when it is pushed

From
Elijah Newren <newren@gmail.com>
Date
Aug 31, 2021, 02:15 UTC
Message-ID
<CABPp-BFE_LB=MYcJ80g=6OjvcXh-SjR_9_ynVdX5i9ruGBqh2Q@mail.gmail.com>
In-Reply-To
<xmqqv93n7q1v.fsf@gitster.g>
On Sun, Aug 29, 2021 at 5:07 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 26 quoted lines
>
> Elijah Newren <newren@gmail.com> writes:
>
> >> Why does Git have to delete and then create again the directory when it
> >> is already there?
> >>
> >>
> >> This isn't a big issue, but it is very odd that git deletes the working
> >> directory.
> >
> > It was deleted by the rebase operation, because rebase (currently)
> > works by first checking out the target commit onto which it will apply
> > all your local patches.  That target didn't have the directory; the
> > directory was added by your local patches.  So checking out that
> > commit necessarily deletes the directory.  Then rebase applies each of
> > your local patches, one by one, updating the working directory as it
> > applies them.  Since your local patches create that directory, it gets
> > re-created by this process.
>
> This is one of the reasons why "rebase" (especially "rebase -i") may
> want to insist starting at the top-level of the working tree, like
> "git bisect" does.  Because running the command from a subdirectory
> works most of the time until it doesn't, people tend to complain why
> they should go up to the top-level before they can run the command.
>
> And this is why---it causes end-user confusion.
Makes sense to me; I'll submit a patch.
Previous: Philip OakleyNext: Junio C Hamano
Message 8 of 9 in “Git re-creates newly added directory when it is pushed”
  1. YuriAug 28, 2021
  2. Elijah NewrenAug 28, 2021
  3. YuriAug 28, 2021
  4. Junio C HamanoAug 30, 2021
  5. YuriAug 30, 2021
  6. Junio C HamanoAug 30, 2021
  7. Philip OakleyAug 30, 2021
  8. Elijah NewrenAug 31, 2021
  9. Junio C HamanoAug 31, 2021

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.