本文介绍了从'git pull'中排除特定文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个生产git回购,我只是将主回购的变化引入;我从来没有改变这个回购或从这里做承诺/推动。我最近意外地将一些未跟踪的(至少我认为是)图像文件从我的本地开发商回购库中推到主要回购库。现在,当我试图从主repo中获取最新版本时,git会报告有关使用主repo文件覆盖现有图像文件的错误。我甚至不希望这个文件从回购站(它位于生产回购站的gitignored目录中)

I have a production git repo that I only pull changes from the main repo into; I never change this repo or do commits/pushes from here. I recently accidentally pushed some untracked (at least I thought they were) image files to the main repo from my local dev repo. Now when I try to pull the latest from the main repo, git reports an error regarding overwriting the exiting image file with the file from the main repo. I don't even want this file from the repo (it's located in a ,gitignored directory on the production repo)

我如何才能摆脱这些不需要的图像文件在我的主要回购,或b)排除这些文件从我的git拉?

How can I a) get rid of these unwanted image files in my main repo, or b) exclude these files from my git pull?

推荐答案

这让我告诉git忽略一个特定的文件,即使它已经是项目的一部分。我对它做出的所有更改都将被忽略:

This allowed me to tell git to ignore a specific file, even though it was already part of a project. All changes I make to it will be ignored:

git update-index --assume-unchanged Localization/el-GR.js

来源:

这篇关于从'git pull'中排除特定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 04:57