I committed some files and tried to push them to the remote repository. However, I found a large video file in the list and terminated the pushing. And then I tried to delete the file from the list and pushed again.
$git commit -m "comments" -a
$git push origin my_branch
... # I found mp4 file here and terminated push
$git rm --cached path/to/mp4
$git commit -m "comments" -a
$git push origin my_branch
Problem
git still tried to push the mp4 file to repo.
Question How do I avoid the deleted file pushing to remote repo?
PS
I also tried git rm path/to/mp4
, the file has removed from my directory but git still tried to push the file to repo
From those commands it looks like the video file is still in the commit history.
Assuming you have made no other commits try the following. If you have just tweak them a bit.
Try reverting to the previous commit
git reset --soft HEAD~1
then do git status and see if you see the file
if you do. then remove it and recommit with
git commit -c ORIG_HEAD
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With