Unable to Git-add with force

瘦欲@ 提交于 2019-12-04 23:52:02

You should not need '--force' or '-f' option: see git add:

-f
--force:

Allow adding otherwise ignored files.

In your case, you may not want to add all files, included ignored files under screen/dev directory.

 git add screen/dev

should be enough (without options or ending '/')

The problem can be solved by renaming the folder and adding the folder with a new name to Git.

This suggests me that there must be some file manipulating the folder name dev.

Is that a typo on cut paste?

If not, it should be

git add --force screen/dev

Try doing:

git add -A .

Also, if you have a .gitignore file it's also possible that you are unintentionally ignoring something (ie: possibly the files you are trying to add).

If nothing works...

  • Move the stubborn directory to a temp location outside the repo
  • Remove any remaining traces of the stubborn directory in the repo
  • Push and make sure that local is synced with remote
  • Move the stubborn directory from the temp location back to the repo (You don't have to rename)
  • git add -A
  • Commit and push

I've also found that you have to have at least a file in that dir in order to be picked up by git. git add screen/dev won't work if there are no files inside.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!