TLDR: I found a solution here -> Remove file from latest commit
I would like git status
to display "Your branch is up to date with 'origin/all_work'" Since I cannot achieve this, I cannot make new commits and push new work.
Oddly, when I try git diff --staged
or git diff --cached
, the commit doesn't show up.
Only when I try git diff origin/main..HEAD
, I see the following read-out with the staged item:
diff --git a/100000000values.zip b/100000000values.zip
new file mode 100644
index 0000000..f910aaf
Binary files /dev/null and b/100000000values.zip differ
I tried git reset --hard
, but this doesn't work. I'm guessing that since this item "100000000values.zip" was a part of the last commit, git reset --hard
is only taking me back to this same commit, which is why this file is still staged after reset. I don't want to reset beyond the most recent commit, because I don't want to lose the commits that did go through.
Is there any way to just delete this file "100000000values.zip" from the staging area without resetting the state?
UPDATE: I finally found that first committing a new set of files and then using git rebase -i
was a solution. I think it was necessary to first commit the files that I wanted to make sure wouldn't get deleted when rebasing. There were then two commits: one with the all the desired files and the too large file, and another with all the desired files, this time excluding the too large file. Then rebasing simply removed that "first in line" commit.