How can I delete a file from a Git repository?

后端 未结 24 2227
無奈伤痛
無奈伤痛 2020-11-22 13:41

I have added a file named \"file1.txt\" to a Git repository. After that, I committed it, added a couple of directories called dir1 and dir2

24条回答
  •  攒了一身酷
    2020-11-22 14:00

    I tried a lot of the suggested options and none appeared to work (I won't list the various problems). What I ended up doing, which worked, was simple and intuitive (to me) was:

    1. move the whole local repo elsewhere
    2. clone the repo again from master to your local drive
    3. copy back the files/folder from your original copy in #1 back into the new clone from #2
    4. make sure that the problem large file is either not there or excluded in the .gitignore file
    5. do the usual git add/git commit/git push

提交回复
热议问题