Answer the question
In order to leave comments, you need to log in
An unnecessary file accidentally got into the remote git repository, how to delete it?
An unneeded file accidentally got into the remote git repository. The fact is that, due to my inexperience, I renamed the demo.sqlite file to db.sqlite. Now two identical files with different names are stored in the remote repository. How to delete? How to avoid such inexperience? We need a proper hack for such a case.
Answer the question
In order to leave comments, you need to log in
How to delete?
git rm -f <имя файла>
git commit
git push
-- remove from HEAD but leave in historygit rebase -i <ревизия в которой файл был добавлен>~1
<пометить самый первый коммит для редактирования заменив peek на e>
git rm -f <имя файла>
git commit --amend
git rebase --continue
git push
-- delete from history completely. If the addition was in the last commit, then the git rebase commands can be omitted.
Avoid like this:
Check out the turnip to a clean directory, do a git rm on an unnecessary file, commit, push - this will be the fastest.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question