How to completely reassign a file from a git repository?

I accidentally clicked on a file in which I do not have rights to a publicly accessible repo.

What can I do to selectively destroy this single file from the repo completely so that its data completely disappears?

+5
source share
2 answers

Git Filter-Branch - your friend in this case is well documented from the beautiful Github

+4
source

Assuming the commit you added the file to is the most recent:

git reset --hard HEAD^
git push --force

, rebase, . git rebase -i xxx, xxx , . , "" . , . , pick edit (, ), git rebase --continue

, , , rebase . , , .

git-filter-branch, , GitHub:

git filter-branch --index-filter 'git rm --cached --ignore-unmatch NAME_OF_THE_FILE' --prune-empty -- --all

, git push --force , ( , - ). github, , .

+2

All Articles