我正在使用Laravel項目並使用git-flow來管理我的更改。我的develop分支是兩個提交前的功能分支我最近完成了名爲功能/註冊驗證碼。我想將這個特性分支合併到develop分支中。如何解決與composer.lock使用git流的合併衝突?
最近提交我做這已經被合併到開發分公司只需運行composer update
更新包,其中有一個bug在裏面。所以,composer.lock
文件當然已被修改。
功能/註冊驗證碼功能分支包括添加驗證碼包和驗證碼UI到註冊頁面。所以,這也修改了composer.lock
文件。
當坐在特性分支我曾嘗試合併提交,從源代碼樹,通過選擇庫> Git的流量>完成功能,然後在完成功能選擇下列選項彈出:
我則以下消息介紹:
這會導致composer.lock
文件中存在需要解析的合併衝突。我認爲最好的方法是刪除composer.lock
並通過運行composer update
或composer update --lock
創建一個新的更新副本,添加unstaged composer.lock
文件並提交更改。這樣做了以後我提交這個樣子:
當在命令行中運行git status
我出以下幾點:
c:\my-project (HEAD detached at 2a9ff12)
λ git status
rebase in progress; onto 3070450
You are currently rebasing branch 'feature/registration-captcha' on '3070450'.
(all conflicts fixed: run "git rebase --continue")
nothing to commit, working directory clean
因此,我認爲做正確的事情是運行git rebase --continue
,之後我收到以下消息:
c:\my-project (HEAD detached at 2a9ff12)
λ git rebase --continue
Applying: add non captcha to registration page
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".
如果我運行git status
再次顯示與上次運行git status
相同的消息。
所以我現在想知道:
- 那我在這裏做,完成變基/合併嗎?
- 我是不是全都做錯了?
- 我應該如何處理更新軟件包時可能產生的衝突?
任何幫助將不勝感激,謝謝!
你不應該刪除composer.lock,並在這種情況下做一個作曲家更新 - 從來沒有!合併衝突是有原因的。在你的方法中,你現在更新了比你想要的更多的包。在這些情況下最簡單的方法就是接受外國的composer.lock,扔掉你的版本。那麼你需要記住你在分支中更新了哪些軟件包(pro-tip:爲你的更新語句創建一個git commit並在註釋中寫入語句)並明確運行作曲者更新。與親技巧這一步可以自動化 –