我如何将丢失的文件拖回到我的分支中 [英] How do I pull missing file back into my branch
问题描述
我已将git项目克隆到本地git存储库中。然后我对其中一个文件做了一些讨厌的事情,并且在这个恐慌中,我从驱动器( rm style.css
)从物理上删除了文件,并且从git( git rm style.css
)。
我想得到原始的 style.css
从原点返回到我的开发分支。不幸的是,我的git认为它是最新的,不会做任何事情。
root @ debian:〜/ project.me# git status
分支开发
没有提交(工作目录干净)
root @ debian:〜/ project.me#git pull origin dev
Password for 'https://someone@github.com':
从https://github.com/somewhere/project.me
*分支开发 - > FETCH_HEAD
已经是最新的。
我需要做些什么来告诉git我想下载原始 style.css
文件返回到我的开发分支?
git结帐
。在你的情况下: git checkout origin / master style.css
这个命令会更新给定分支的请求文件(这里是远程分支 origin / master
)。
希望这有助于
I have cloned git project into local git repository. Then I have done something nasty to one of the files and in that panic I deleted file physically from drive (rm style.css
) and also removed it from git (git rm style.css
).
I want to get original style.css
back from origin to my dev branch. Unfortunately my git thinks it is up-to-date and wont do anything.
root@debian:~/project.me# git status
# On branch dev
nothing to commit (working directory clean)
root@debian:~/project.me# git pull origin dev
Password for 'https://someone@github.com':
From https://github.com/somewhere/project.me
* branch dev -> FETCH_HEAD
Already up-to-date.
What do I need to do to tell git that I want to download original style.css
file back into my dev branch?
Use git checkout
. In your case:
git checkout origin/master style.css
This command will update the requested file from the given branch (here the remote branch origin/master
).
Hope this helps
这篇关于我如何将丢失的文件拖回到我的分支中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!