2015-03-31 41 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看作追溯合併。

相關問題