我一直在使用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 ×1