I recently forked a project and after a few dozen commits, noticed there was some sensitive info I wanted to remove from a file. While wanting to remove that, either by undoing only my commits for that file, and redoing changes as one, or possibly replacing a text string, I found BFG. What I ran was:
bfg --replace-text replacements.txt -fi file .
and then 'git reflog expire…' as suggested by the BFG output. After force pushing to remote, my fork nows says:
This branch is XXX commits ahead, XXX commits behind …:master.
Too late now perhaps to undo unless I want to refork and add my changes as one commit. Is there any fix?
edit: My situation is very similar to the one here:
Git Merge Duplication after Ineffective BFG Use
git log doesn't show anything wrong but using other apps, I see the entire history has duplicates for each commit. Github Desktop also shows two branches, master and originalproject/master and I remember it only showing master before. I don't quite know enough about git to figure out the next step. Trying a git reset --hard master xxxx using the commit id from log says 'Cannot do hard reset with paths'.