当我使用git时,遇到了一个非常奇怪的问题,详细情况如下:
我从远程拉取了一个包,但是git status显示它是最新的:
XXXService weiheng$ git status
On branch mainline
Your branch is up-to-date with 'origin/mainline'.
nothing to commit, working directory clean
XXXService weiheng$ git pull
Already up-to-date.
然后我修改了一个文件,git status显示如下:
XXXService weiheng$ git status
On branch mainline
Your branch is up-to-date with 'origin/mainline'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: configuration/app/XXXService.conf
no changes added to commit (use "git add" and/or "git commit -a")
好的,目前看起来一切都很正常。但是,当使用git add命令将更改暂存时,还会添加三个额外的文件:
XXXService weiheng$ git add configuration/app/XXXService.cfg
XXXService weiheng$ git status
On branch mainline
Your branch is up-to-date with 'origin/mainline'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: configuration/app/XXXService.conf
new file: configuration/tomcat-setup-env-Alpha/RemoteDebugging.xml
new file: configuration/tomcat-setup-env-Beta/RemoteDebugging.xml
new file: configuration/tomcat-setup-env-Gamma/RemoteDebugging.xml
我没有在git中设置任何挂钩。我尝试将这三个文件重置为HEAD,但是它不起作用,而且git状态显示与上述相同。
XXXService weiheng$ git reset HEAD configuration/tomcat-setup-env-Alpha/RemoteDebugging.xml
XXXService weiheng$ git status
On branch mainline
Your branch is up-to-date with 'origin/mainline'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: configuration/app/XXXService.conf
new file: configuration/tomcat-setup-env-Alpha/RemoteDebugging.xml
new file: configuration/tomcat-setup-env-Beta/RemoteDebugging.xml
new file: configuration/tomcat-setup-env-Gamma/RemoteDebugging.xml
感谢您的提前帮助!期待着...(此处缺少上下文,无法准确翻译)
git reset
之前,configuration/app/XXXservice .conf 被标记为已修改,而在你的git reset
之后,configuration/ brazil-config /app/XXXservice .cfg 被标记为已修改。它们完全不匹配。 - torekbrazil-config
,而其他的没有。 如果您正在编辑 Git 的输出,则可能会使任何可能看到此问题的人更难以识别该问题。 - torek