简体   繁体   中英

How do I remove a deleted but committed file from git?

I a have a file that has been moved from its folder, git sees this file as removed, so you run:

git add -u

This adds the deleted file to your 'Changes to be committed', I've tried to use:

git rm 
git clean -f and -n

Has anyone come across a similar issue? Here what the git status states:

git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)
  deleted: path/file.txt

I'm running Windows 8 with git bash.

要提交更改,请执行git commit

I believe you are trying to remove a file from the entire git history.

To do so, following the answer on the following page will help:

Remove sensitive files and their commits from Git history

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM