【发布时间】:2016-11-22 17:33:55
【问题描述】:
我知道类似的问题已经在一堆帖子中得到解决,但我还是不知道如何解决这个问题。
所以,我已经用这个 git repo 同步了我的本地目录
Dario (master *) replicationKumar $ git remote -v
origin git@github.com:DarioBoh/replicationKumar.git (fetch)
origin git@github.com:DarioBoh/replicationKumar.git (push)
我成功推送了一些提交,所以我很有信心我已经正确同步了所有内容。 还有,我跑了
Dario (master *) replicationKumar $ git pull origin master
From github.com:DarioBoh/replicationKumar
* branch master -> FETCH_HEAD
Already up-to-date.
这表明我应该复制我在 github 上的内容。 自上次提交以来,我删除了一些文件,现在我想从这次提交的远程目录中恢复所有文件
Dario (master *) replicationKumar $ git log
commit 91a3dfdb30084654a7a5517250d2a70dfddb931b
Author: DarioBoh <bonarettidario@gmail.com>
Date: Tue Jul 19 10:00:12 2016 -0500
REFACTOR linechart moved from server to chart.R
其实本地目录目前是这样的
Dario (master *) replicationKumar $ ls -a
. .RData .Rproj.user .gitignore
.. .Rhistory .git replicationKumar.Rproj
我以为 checkout 会完成这项工作,我做到了
Dario (master *) replicationKumar $ git checkout 91a3dfdb30084654a7a5517250d2a70dfddb931b
D charts.R
D datasets.R
D server.R
D sidebarMenu.R
D ui.R
D ui1.R
D ui2.R
Note: checking out '91a3dfdb30084654a7a5517250d2a70dfddb931b'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 91a3dfd... REFACTOR linechart moved from server to chart.R
但是,我的本地目录并没有像我预期的那样显示检出提交中存在的文件
Dario ((91a3dfd...) *) replicationKumar $ ls -a
. .Rhistory .gitignore
.. .Rproj.user FETCH_HEAD
.RData .git replicationKumar.Rproj
【问题讨论】: