相关疑难解决方法(0)

忽略已提交到Git存储库的文件

我有一个已经初始化的Git存储库,我添加了一个.gitignore文件.如何刷新文件索引以便忽略我想忽略的文件?

git version-control caching gitignore git-rm

2429
推荐指数
21
解决办法
68万
查看次数

在分支机构检出之间保留git --assume-unchanged文件

我一直在使用git --assume-unchanged yacs/settings/development.py我的dev分支中忽略我的本地数据库配置文件.但是当我想切换分支(用于部署)时,我得到一个错误,我仍然有待更改:

% git checkout production
error: Your local changes to the following files would be overwritten by checkout:
    yacs/settings/development.py
Please, commit your changes or stash them before you can switch branches.
Aborting
Run Code Online (Sandbox Code Playgroud)

这很烦人.我知道如何解决这个问题的唯一方法就是隐藏它:

% git stash
% git checkout production
% git merge dev
% ./deploy.sh
% git checkout dev
% git stash pop
# On branch dev
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
# …
Run Code Online (Sandbox Code Playgroud)

git

36
推荐指数
1
解决办法
9922
查看次数

标签 统计

git ×2

caching ×1

git-rm ×1

gitignore ×1

version-control ×1