3

I need to delete configuration files from my web application and from the git history. I've done that using the bfg repo cleaner tool. I went through the steps outlined in the documentation:

  1. git clone --mirror url.git
  2. java -jar bfg-1.13.0.jar --delete-files "{App.config,Web.config}" repo-name.git
  3. git reflog expire --expire=now --all && git gc --prune=now --aggressive

I pushed the result to a new repository in gitlab. The files are gone from the history. I can checkout an old commit and the files do not come down.

BUT when I look at the details of commit involving Web.config file the changes section shows the diff of the Web.config file. So it is still possible to see the text of the configuration files.

Did I miss something in my use of the bfg tool? Or is this something the tool will not change? How can I remove the files from the commit changes summary?

mbomb007
  • 3,788
  • 3
  • 39
  • 68
tamster008
  • 33
  • 5

2 Answers2

1

BUT when I look at the details of commit involving Web.config file the changes section shows the diff of the Web.config file. So it is still possible to see the text of the configuration files.

Unfortunately there are several nuances to interpreting how a history rewrite went, and the above description is vague - where are you seeing this? Are you executing a diff command against your local repo, or looking at a url on the GitLab? - supplying a screenshot, url or example Git commmand that you're invoking would be useful for diagnosis here.

I am going to assume that you are looking at a url like this, where a commit id (eg e081c0cba2dd5b1a19d22b44918022f72035434c) is part of the url:

https://gitlab.com/gitlab-org/gitlab-ce/commit/e081c0cba2dd5b1a19d22b44918022f72035434c

The important thing to realise here is that commit ids are a hash of the contents of that commit's file tree, AND the entire commit history leading up to that commit. So if you change the history of a commit, you get a new commit id. If you look at the old commit id - you're going to see the old commit data, and the old commit file tree.

When's that going to go away?

Eventually GitLab will run git gc on your repository, and that url - with that commit id in - will no longer be accessible. You can also ask GitLab support to run the git gc:

Roberto Tyley
  • 24,513
  • 11
  • 72
  • 101
-1

Is that not just that the *.config files are only in the last commit?

This commit is left untouched by BFG, so perhaps it's what you see....

From BFG doc:

Your current files are sacred...

The BFG treats you like a reformed alcoholic: you've made some mistakes in the past, but now you've cleaned up your act. Thus the BFG assumes that your latest commit is a good one, with none of the dirty files you want removing from your history still in it. This assumption by the BFG protects your work, and gives you peace of mind knowing that the BFG is only changing your repo history, not meddling with the current files of your project.

Community
  • 1
  • 1
Philippe
  • 28,207
  • 6
  • 54
  • 78