2010-06-26 114 views

回答

2

簡短的回答:不,這不是如何棧作品。儘管如此,您可以執行以下操作來獲取所需的結果。

假設你已經藏匿了一些其他變化,然後做出一些修改索引(原創變化)和您決定要保留這些變化,同時修改藏匿:

#verify the state you are in 
git stash list 
git status 

git stash #push work in progress on the stash 
git stash list #check which stash you need 
git stash show [email protected]{1} #check the changes in the stash 

git stash pop [email protected]{1} #you're now ready to change your 'other' changeset 
# hack hack 
git stash #modified 'other' change set pushed on the stash 
git stash pop [email protected]{1} #your 'original changes' 

我建議這個工作流程直接試圖修改存儲。如果你迷路了,你還可以使用git stash save 'some other changes'

在某個點(可能比你想象的更近)跟蹤真正的分支更容易。

1

你可以試試,你彈出堆棧,以紀念該文件後,你不想藏匿的「不變」:

git update-index --assume-unchanged -- /path/to/file 

,然後嘗試藏起來,檢查是否包含所述文件或不。

git update-index man page

--assume-unchanged 
--no-assume-unchanged 

當指定這些標誌,不更新記錄的路徑對象名稱。
而是,這些選項設置和取消設置路徑的「假定不變」位。

當「假設不變」位打開時,git停止檢查工作樹文件以進行可能的修改,因此當您更改工作樹文件時,需要手動取消設置該位以告訴git。
在處理系統調用速度很慢的文件系統(例如cifs)上的大型項目時,這有時會很有幫助。

這個選項也可以用來作爲粗略文件級別機制忽略跟蹤的文件提交的更改(類似於什麼.gitignore確實爲未跟蹤文件)

相關問題