[英]Un-ignore a directory added to .gitignore
What I did was to have two branches: 我要做的是拥有两个分支:
In my local
branch I have all my asset folders css
, js
, and img
. 在我的local
分支中,我拥有所有的资产文件夹css
, js
和img
。 And in my production
branch I added them to my .gitignore
since I want to host those assets elsewhere. 在我的production
分支中,我将它们添加到.gitignore
因为我想将这些资产托管在其他位置。
css/
img/
js/
so these folders aren't visible in the production
branch anymore. 因此这些文件夹在production
分支中不再可见。 Is there anyway to restore the img
folder in the production
branch? 无论如何,要在production
分支中还原img
文件夹吗? I tried removing img/
from my .gitignore
and committing but it won't list on my untracked files. 我尝试从.gitignore
删除img/
并提交,但是它不会在未跟踪的文件中列出。
After removing img/
from your .gitignore
, you can git checkout local -- img
to check out the files from the local branch (assuming you are on the production branch). 从.gitignore
删除img/
之后,您可以git checkout local -- img
从本地分支中签出文件(假设您在生产分支中)。 They should automatically be staged (otherwise just stage them yourself), and commit them to your production branch. 应该自动暂存它们(否则就自己暂存),并将它们提交到生产分支。
Take a look at this: Not ignore a file in a sub directory? 看一看: 不忽略子目录中的文件吗?
It should work for the folder as well 它也应该适用于该文件夹
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.