English 中文(简体)
为什么要核对以前在指数上出现的改动?
原标题:Why are files checked out to previous changesets appearing in the index as modified?
  • 时间:2011-08-18 16:31:15
  •  标签:
  • git
D:codegt>git init
Initialized empty Git repository in D:/code/gt/.git/

D:codegt>echo Zero > a

D:codegt>git add a

D:codegt>git commit -m a
[master (root-commit) 392580e] a
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a

D:codegt>echo One > a

D:codegt>git add a

D:codegt>git commit -m another
[master 271efba] another
 1 files changed, 1 insertions(+), 1 deletions(-)

D:codegt>echo Second > a

D:codegt>git add a

D:codegt>git commit -m "yet another"
[master 8d2041e] yet another
 1 files changed, 1 insertions(+), 1 deletions(-)

D:codegt>git status
# On branch master
nothing to commit (working directory clean)

D:codegt>git checkout  271ef a

D:codegt>git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   a
#

如你所知,我检查了第2次袭击时所拥有的档案。 然而,我不理解为什么它已经列入指数。 为什么要让我做些什么?

最佳回答

这一点从giteckout 文件中完全清楚,因此这是一个很好的问题。

您:

git checkout COMMIT -- PATH

页: 1 <代码>PATH索引的增订版见COMMIT。 因此,相对于HEAD,该档案在管理该指挥后确实进行了改动。

问题回答

暂无回答




相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签