Skip to content

Mirror clone "does not look like a fresh clone" because of stashes? #652

Open
@Rhys-T

Description

@Rhys-T

I was trying to clean up something that accidentally got committed to a local repo. I used git clone --mirror --no-local to make a clean copy, cd'd into it, and tried running git-filter-repo --sdr --replace-text ../replace-text.txt, and got this:

Aborting: Refusing to destructively overwrite repo history since
this does not look like a fresh clone.
  (has stashed changes)
Note: when cloning local repositories, you need to pass
      --no-local to git clone to avoid this issue.
Please operate on a fresh clone instead.  If you want to proceed
anyway, use --force.

even though it is a fresh clone. The original repo does have some stashes in it. They don't seem to fully exist in the mirror - there's no refs/stash (EDIT: see #652 (comment)) or logs/refs/stash - but some of the underlying commits did get copied over.

How does git-filter-repo know about the stashes, and what should I do about this error? According to the "DESCRIPTION" section of the manual, it's supposed to be able to rewrite stashes by default, but I don't see any specifics on how to go about that safely. --force seems like the wrong option, since the stash ref isn't there…?

(Apologies if I missed any obvious documentation about this anywhere.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions