I recently made a push to an upstream branch that accidentally added in a large file we do not want in the repository. I want to remove it.
It's the most recent push that added this file, and it's not on the master branch. It's just a very recently-created branch with only one commit.
I have looked over previous SO questions on this among other sources, and am unclear on what I can do:
- This answer implies that just using filter-tree doesn't actually free up the space in the repository, which is the entire reason I want to remove the large file.
- The above answer also suggests remove-blob, which I cannot access. I am stuck with vanilla git operations, not extensions or otherwise.
- Other site like this suggest that if it's already pushed, filter-branch may not even work? I'm not even sure how to interpret how to use
--force-with-lease
here. - It's also unclear from a lot of these answers if I need to be specifying some kind of a path to a file, or if it will just wipe any instance of that file from any location in the repo.
Would cherry-picking the changes from this commit to a new branch as unstaged changes, deleting the file, pushing the branch upstream and deleting the old branch locally and pushing the deletion up, potentially fix this?