相关疑难解决方法(0)

在分支机构检出之间保留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假设未更改vs跳过工作树 - 忽略符号链接

我有一个git存储库和Windows的问题.问题是git存储库中有一个linux符号链接,并且开发人员运行windows,这显然不起作用.现在因为这个符号链接永远不会改变,我想找到一种方法来删除开发人员并在其位置添加一个文件夹(这是符号指向的),但让git忽略这些特定的更改.现在我可以删除符号链接,创建一个同名文件夹,只需添加一个忽略所有内容的.gitignore.现在,为了确保git忽略了符号链接的删除,我在研究时发现了两种可能的解决方案.我找到的解决方案是:

git update-index --assume-unchanged [FILE]
git update-index --skip-worktree [FILE]
Run Code Online (Sandbox Code Playgroud)

我的问题是哪种方案效果最好?我想确保一旦我这样做,除非我特意这样做,否则它永远不会被撤消.我想确保恢复,重置,创建分支,合并等...一切正常.

git symlink git-index

24
推荐指数
1
解决办法
8190
查看次数

标签 统计

git ×2

git-index ×1

symlink ×1