Irina Rapoport
Irina Rapoport

Reputation: 1692

Files deleted with git filter-branch reappear after push and pull back

I have some sensitive info in the repository. Trying to sanitize it and then push to GitLab. However, once pulled from GitLab, the sanitized info reappears. Where is my mistake?

git log -Smypassword

<returns some commits showing that mypassword is indeed in the repo>

# clean the repo from mypassword
git filter-branch -f --tree-filter "find . -name '*.js' -exec sed -i -e 's/mypassword/nomorepassword/g' {} \;"^C

git log -Smypassword
<nothing found, indicating that git filter-branch worked>

git remote add origin [email protected]:user/project.git

# I have two unmerged branches
git push -u origin master
git push -u origin accounts

cd ../fresh

git clone  [email protected]:user/project.git

git log -Smypassword

<returns some commits again> 

What am I doing wrong?

Upvotes: 1

Views: 245

Answers (1)

Irina Rapoport
Irina Rapoport

Reputation: 1692

I merged the other branch into master and redid it. Works now. Can't tell whether it was an error on my part, or two branches have something to do with it.

Upvotes: 1

Related Questions