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

275 views Asked by At

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?

1

There are 1 answers

0
Irina Rapoport On BEST ANSWER

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.