6

今天第二次git commit -m "don't quit me now"删除我的整个回购。就这样:

$ git add .
$ git commit -m "please, be gentle"

[master 7af0e9c] please, be gentle
140 files changed, 0 insertions(+), 3186 deletions(-)
delete mode 100644 .DS_Store
delete mode 100644 .gitignore
delete mode 100644 .rspec
delete mode 100644 Gemfile
...

我一直在命令行旁边使用 Github for Mac,想知道这是否会以某种方式使事情变得更好。

$ git checkout
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   deleted:    .DS_Store
#   deleted:    .gitignore
#   deleted:    .rspec
#   deleted:    Gemfile
#   deleted:    Gemfile.lock
4

1 回答 1

5

由于git status告诉您所有内容都已准备好删除,因此在执行其他任何操作之前,请将索引重置为HEAD

git reset HEAD

这样做之后,git status应该回显

no changes added to commit (use "git add" and/or "git commit -a")

然后,再试一次:

git add .
git commit -m "new try"
于 2012-04-11T10:45:11.470 回答