如何使git合并处理我的工作树的未提交更改? [英] How to make git merge handle uncommitted changes to my working tree?
问题描述
$ git merge origin / master
更新1b8c5c6..eb44c23
错误:条目'blah.java'不是最新的。无法合并。
从颠覆背景来看,我习惯于让我的工作树在我修改时自动合并从存储库中,如果有冲突,我手动解决它们。
我发现在git中这样做的最快捷方式是:
$ git stash
$ git merge origin / master
$ git stash pop
实质上,删除未提交的更改,进行合并,然后重新应用更改。我怎么能告诉合并自动合并我的工作树与我试图拉的变化?
至于我可以告诉你,你可以做的最好的事情就是你已经有了 git stash
。我也觉得合并只想处理干净的树木很奇怪。
A co-worker and I are both working on the master branch at the moment. I have some code in my working tree that I don't want to commit (debugging statements and the like). Now if he commits changes to some of those same files, I can't merge them:
$ git merge origin/master
Updating 1b8c5c6..eb44c23
error: Entry 'blah.java' not uptodate. Cannot merge.
Coming from a subversion background, I'm used to having my working tree automatically merged when I pull changes from the repository and if there are conflicts, I resolve them manually.
The quickest way I have found to do this in git is:
$ git stash
$ git merge origin/master
$ git stash pop
Essentially, removing my uncommitted changes, doing the merge and then re-applying the changes. How can I tell merge to automatically merge my working tree with the changes I'm trying to pull in?
As far as I can tell, the best you can do is what you already have with git stash
. I too find it strange that merge wants to deal only with clean trees.
这篇关于如何使git合并处理我的工作树的未提交更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!