2021年1月27日星期三

git-filter-repo used with literal expressions deleted a whole bunch of files and branches

Based on this, I've tried to run git-filter-repo on a git local repo to replace some plain data in a single docker-compose.yml file using this expressions.txt file:

literal:DB_NAME=my_secret_database==>DB_NAME=${DB_NAME}  literal:DB_PASSWORT=my-secret-password==>DB_PASSWORT=${DB_PASSWORT}  

and running it as:

$ git-filter-repo --path-glob 'docker-compose.yml' --replace-text expressions.txt --force  

*disclaimer on the usage of --force: https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html#FRESHCLONE

The resulting message seems fine:

Parsed 212 commits  New history written in 0.39 seconds; now repacking/cleaning...  Repacking your repo and cleaning out old unneeded objects  HEAD is now at f7544c8 Refactor docker-compose file # <-- this was definitely NOT my HEAD prior to that  Enumerating objects: 33, done.  Counting objects: 100% (33/33), done.  Delta compression using up to 4 threads  Compressing objects: 100% (20/20), done.  Writing objects: 100% (33/33), done.  Total 33 (delta 12), reused 33 (delta 12), pack-reused 0  Completely finished after 0.49 seconds.  

But then, many (many!) files simply disappeared from my repo, such as (non-exhaustive):

init.sh
.gitignore
.dockerignore
requirements.txt
Dockerfile
Dockerfile.dev
...

And I only got 11 commits left (/212 initially), strangely only those including modifications on the docker-compose.yml file, and I only have two branches left, again, only the ones including the docker-compose.yml file, all others are gone. I feel like I'm living in a wrong mirror world...

What did I do wrong/missed?

If that helps:

$ git-filter-repo --version  10401e45d5f0    $ git --version  git version 2.30.0  
https://stackoverflow.com/questions/65929633/git-filter-repo-used-with-literal-expressions-deleted-a-whole-bunch-of-files-and January 28, 2021 at 09:07AM

没有评论:

发表评论