2013-04-03 69 views
1

我有本地回购和远程,说“上游”。在远程回购的一些基本CONFIGS说“FILE1.TXT”和“FILE2.TXT”,我拉变为分公司“some_branch”,和类型:git - 忽略提交的文件和开关分支

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“,但也不成功。

那么,我怎么可以跳过本地更改使用“添加”或“提交-a”,但能够改变分支,并将这个隐藏的更改应用到其他分支,不是从当前创建?

回答

1

藏匿一切尝试:

git stash save --all --no-keep-index 
+0

但是当我回来的第一个分支,我不能恢复状态,当我使用“git的藏匿应用”,它说“无法恢复从藏匿未跟踪文件 “ – anber

+0

http://blog.tfnico.com/2012/09/git-stash-blooper-could-not-restore.html –

+0

有时git让我哭... – anber