从命令行看到以下内容后:
# On branch RB_3.0.10
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: index.htm
Run Code Online (Sandbox Code Playgroud)
我试图通过键入命令来放弃我的更改:
git checkout -- index.htm
Run Code Online (Sandbox Code Playgroud)
但是当我重新运行git status时,它看起来完全一样.结帐似乎不起作用.难道我做错了什么?我在windows/cygwin上使用GIT 1.6.1.2.
# On branch RB_3.0.10
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: …Run Code Online (Sandbox Code Playgroud) 我有一个项目与某些js文件,我无法更新.我在本地运行OSX,而我的远程/临时服务器是Linux(CentOS).
在本地克隆我的项目后,我注意到我有所有那些具有git状态的文件modified.我从来没有修改它们,所以我尝试了discard changes或者reset它们,但它们再次出现.修改中的更改是删除所有行并再次添加它们.
我不确定为什么会发生这种情况或如何解决它,以便我的git状态是干净的,因为它需要.
以下是git状态的几行:
# modified: app/webroot/js/ckeditor/plugins/devtools/lang/el.js
# modified: app/webroot/js/ckeditor/plugins/devtools/lang/fa.js
# modified: app/webroot/js/ckeditor/plugins/devtools/lang/gu.js
Run Code Online (Sandbox Code Playgroud)
更新1:
我现在设法提交上述文件,但登台服务器被锁定,因为它不会提取新的编辑:
error: Your local changes to the following files would be overwritten by merge:
app/webroot/js/ckeditor/_source/lang/ar.js
app/webroot/js/ckeditor/_source/lang/bg.js
app/webroot/js/ckeditor/_source/lang/bn.js
app/webroot/js/ckeditor/_source/lang/cs.js
...
Aborting
Run Code Online (Sandbox Code Playgroud)
我无法提交/推送,因为:
Updates were rejected because a pushed branch tip is behind its remote counterpart
Run Code Online (Sandbox Code Playgroud)
我试过了:
git reset --hard
Run Code Online (Sandbox Code Playgroud)
和
git stash
git stash drop
Run Code Online (Sandbox Code Playgroud)
但它们不起作用,没有任何反应.
更新2:
git diff 给我:
The file will have its original line endings in your …Run Code Online (Sandbox Code Playgroud)