newren / git-filter-repo

Quickly rewrite git repository history (filter-branch replacement)
Other
8.55k stars 708 forks source link

git filter-repo --invert-paths --path <directory/file> creating duplicate branches #530

Closed Bharath0601 closed 3 months ago

Bharath0601 commented 11 months ago

I am trying to remove a file from git history using git filter-repo using the below command

git filter-repo --invert-paths --path <directory/file>

git filter-repo --invert-paths --path <directory/file> Parsed 57789 commits New history written in 15.33 seconds; now repacking/cleaning... Repacking your repo and cleaning out old unneeded objects Enumerating objects: 601836, done. Counting objects: 100% (601836/601836), done. Delta compression using up to 12 threads Compressing objects: 100% (109070/109070), done. Writing objects: 100% (601836/601836), done. Selecting bitmap commits: 83010, done. Building bitmaps: 100% (321/321), done. Total 601836 (delta 509044), reused 577850 (delta 485065), pack-reused 0 Completely finished after 97.30 seconds.

The command was executed successfully with the above results, however, it created some duplicate branches with almost similar names with a difference in case, How to avoid creation of duplicate branches in this scenario? I have been reading some documents that this operation may create duplicate branches if the file is part of too many branches and in order to accommodate changes and to help in preserving the integrity of the repository history.

newren commented 3 months ago

Um, the only reason it would create branches that differed in case was if your original clone had remote tracking branches that only differed in case. So, in that case, the problem was that the source you started with had the problem; it wasn't invented by filter-repo.

Perhaps try running git ls-remote origin (before even doing this filtering) and looking to see all the "duplicate" branch names that already exist?

I'll assume this answers the question and close this out, but let me know and reopen if it doesn't for some reason.