2015-03-31 57 views
3

也许你可以纠正我,我怕这可能是很简单的:为什么我可以重新绑定,但是我不能在git中合并?

所以,从我了解它的方式混帐合并和git底垫2种不同的方式来完成同样的目标:因此,如果我可以变基我也可以合并。

现在,我试图合并mybranch有高手,但是当从mybranch,我做

git merge master 

我得到“已经跟上时代的”,虽然有几个差异,当我做

git rebase master 

它开始rebasing。另外,当我解决一些冲突,加上固定的文件,然后执行

git rebase --continue 

我得到这个错误:

Applying: my commit xxx 
No changes - did you forget to use 'git add'? 
If there is nothing left to stage, chances are that something else 
already introduced the same changes; you might want to skip this patch. 

When you have resolved this problem, run "git rebase --continue". 
If you prefer to skip this patch, run "git rebase --skip" instead. 
To check out the original branch and stop rebasing, run "git rebase --abort". 

这里的现状:

* 179dcec (origin/myBranch, myBranch) Merge branch 'myBranch' of https://github.com/repo/myRepo into myBranch 
|\ 
| * ee8525b Merge branch 'myBranch' of https://github.com/repo/myRepo into myBranch 
| |\ 
| | * 975a4f2 changed the name 
| | * 153450b Fixed jshint problems 
| | * b6eee76 Merge branch 'master' of https://github.com/repo/myRepo into myBranch 
| | |\ 
| | * | 70e3139 Fixed a bug 
| | * | 715d308 fixed a bug 
| | * | ccfd06a Merge branch 'master' of https://github.com/repo/myRepo into myBranch 
| | |\ \ 
| | * | | 03c87f2 deleted useless test file 
| | * | | dd09f21 Testing 
| | * | | 214af56 Integrated the unified DB 
| | * | | 43242ff Merge branch 'master' of https://github.com/repo/myRepo into myBranch 
| | |\ \ \ 
| | * \ \ \ f9ecae6 Merge branch 'master' of https://github.com/repo/myRepo into myBranch 
| | |\ \ \ \ 
| | * | | | | 626bb26 Error handler integrated 
| | * | | | | ac92b60 Merge branch 'master' of https://github.com/repo/myRepo into myBranch 
| | |\ \ \ \ \ 
| | * \ \ \ \ \ 9f6c0b2 Merge branch 'master' of https://github.com/repo/myRepo into myBranch 
| | |\ \ \ \ \ \ 
| | * | | | | | | b09ce40 added DB error handler 
| * | | | | | | | d3ebb13 changed the name 
| * | | | | | | | f68281e Fixed jshint problems 
| * | | | | | | | 31cb0b3 Fixed a bug 
| * | | | | | | | 74d8735 fixed a bug 
| * | | | | | | | cb3e6e2 deleted file 
| * | | | | | | | 80d7164 Testing 
| * | | | | | | | 191fb77 Integrated the unified DB 
| * | | | | | | | 2af7142 Error handler integrated 
| * | | | | | | | fff8b2f added DB error handler 
| | |_|_|_|_|_|/ 
| |/| | | | | | 
* | | | | | | | 730b412 deleted useless test file 

这是怎么回事?

+0

如果你试图将'master'与'mybranch'合并,那么当你坐在你的主分支上时你需要进行合并。因此'git checkout master'然后'git merge mybranch' – 2015-03-31 18:12:43

+0

不确定,这是在github上还是我可以查看的地方? – djechlin 2015-03-31 18:28:14

+0

@aus_lacy OP正试图将主人合并为mybranch,这是不同的。 – djechlin 2015-03-31 18:29:05

回答

0

from how I understood it git merge and git rebase are 2 different way to accomplish the same goal: therefore if I can rebase I can also merge

就这么重订和合并的意愿(假定任何合并冲突得到解决同样的方式)风与在所产生的尖端相同内容的真实 - 但重订,使一个新的每个重建基础犯犯,连续回放新基础提交的内容(master)中的每个更改。合并保留当前历史记录,并将新的提交添加到每个分支上的所有提交中的更改,因为合并基数合并为一个新提交。

如果你记住每个提交是完整的内容,这很容易理解:对于合并,git只是将左分支的顶端与合并基底区分开来,将右分支的顶端与合并进行比较基地,结合所有看起来独立的外表,并让你理清看起来可能会冲突的任何外表。如果必须的话,你可以自己做一样的diff/patch序列。

所以你可以把rebase看作追溯合并。

相关问题