开发者

git add -A doesn't seem to work, have to manually do git rm ../../file.name

开发者 https://www.devze.com 2022-12-13 01:49 出处:网络
I did: 开发者_如何学运维 git add -A so that all my updates would be ready for commit, but for some reason it says that I have to manually do a git rm for each file that was deleted before I can comm

I did:

开发者_如何学运维
git add -A

so that all my updates would be ready for commit, but for some reason it says that I have to manually do a git rm for each file that was deleted before I can commit the changes.

why is that, I thought git add -A did everything in terms of adding any new files, deleting old ones, etc. (getting them ready for commit)?


Looking at the title of your question, I see that git says that ../../file.name needs to be git-deleted. So it seems that you did the git add in a directory two levels below the one that holds file.name. However, this won't work. git add works on the current directory and directories below that one, not in directories higher up in the hierarchy. Unless you specify a path, of course.

Update:

This is documented, although the hint is a bit hidden. From man git-add:

A, --all

Update files that git already knows about (same as --update) and add all untracked files that are not ignored by .gitignore mechanism.

and

-u, --update

Update only files that git already knows about, staging modified content for commit and marking deleted files for removal. This is similar to what "git commit -a" does in preparation for making a commit, except that the update is limited to paths specified on the command line. If no paths are specified, all tracked files in the current directory and its subdirectories are updated.


Did you run the command in the root of the repository?


These files you can commit using git commit -a. See git-commit documentation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号