在我的機器上,我已將--skip-worktree
設置爲config/database.yml
。使用另一個分支中的--skip-worktree處理文件更改
git update-index --skip-worktree config/database.yml
另一名開發者一直致力於和項目工作,同時合併到開發分支的變化config/database.yml
。
現在,當我做git pull origin develop
,我得到
Andrews-Air:[project] agrimm$ git pull origin develop
From bitbucket.org:[company]/[project]
* branch develop -> FETCH_HEAD
Updating [SHA]..[Another SHA]
error: Your local changes to the following files would be overwritten by merge:
config/database.yml
Please, commit your changes or stash them before you can merge.
Aborting
我應該如何處理這樣的變化?我應該怎麼做
git update-index --no-skip-worktree config/database.yml
git stash save "Save changes to config/database.yml"
git pull origin develop
git stash apply
# Fix any conflicts
git update-index --skip-worktree config/database.yml
還是有沒有一個不太好的方法?
不是100%肯定這件事,但我懷疑讓你的skip-worktree使用git會完成這項工作。 'printf'%s \ n''*''!config/database/yml'> .git/info/sparse-checkout; git config core.sparsecheckout true',因爲你已經有了skip-worktree,這應該足夠了。 – jthill