我有本地仓库和远程,说“上游”。在远程仓库中,一些基本配置说“file1.txt”和“file2.txt”,我将更改拉到分支“some_branch”,然后输入:
git update-index --assume-unchanged file1.txt
git update-index --assume-unchanged file2.txt
要允许修改此文件,请使用我不想提交的本地更改添加一些更改。
之后在“上游”中添加了分支“somefeature”
fetch upstream somefeature:somefeature
并尝试:
$git checkout somefeature
error: Your local changes to the following files would be overwritten by checkout:
file1.txt
file2.txt
Please, commit your changes or stash them before you can switch branches.
Aborting
$git checkout -f somefeature
error: Entry 'file1.txt' not uptodate. Cannot merge.
然后我尝试:
$git stash
No local changes to save
$git stash -u
No local changes to save
$git update-index --no-assume-unchanged .
Ignoring path
我也试过“--skip-worktree”,但也没有成功。
那么,如何使用“add”或“commit -a”跳过本地更改,但能够更改分支,并将此隐藏的更改应用于非其他分支,而不是从当前创建的?