相关疑难解决方法(0)

如何丢弃Git中的未分级更改?

如何放弃工作副本中不在索引中的更改?

git version-control

4562
推荐指数
38
解决办法
242万
查看次数

似乎无法放弃Git的变化

从命令行看到以下内容后:

# 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)

git revert

115
推荐指数
7
解决办法
5万
查看次数

Git拒绝重置/丢弃文件

我有一个项目与某些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)

git git-status

75
推荐指数
4
解决办法
3万
查看次数

标签 统计

git ×3

git-status ×1

revert ×1

version-control ×1