[英]Why is Git not push'ing a merge?
我正在嘗試合並此請求請求 。 我執行了以下步驟(直接取自Bash歷史記錄):
git checkout -b wyattoday-fix-junk-defines master
git pull https://github.com/wyattoday/cryptopp.git fix-junk-defines
git checkout master
git merge -S --squash wyattoday-fix-junk-defines
我試圖同時使用git push origin master
和git push
。 在兩種情況下,Git都會返回:
$ git push origin master
Username for 'https://github.com': noloader
Password for 'https://noloader@github.com':
Everything up-to-date
由於我合並了補丁程序,因此所有內容都不是最新的。 更改后,我看不到已刪除的代碼:
$ grep WORKAROUND_MS_BUG_Q258000 *.h *.cpp
$
我確認自己在師父上:
$ git branch
* master
noloader-master
wyattoday-fix-junk-defines
為什么Git不推送合並? 我該如何解決該問題?
如果您運行git status
我相信您會發現您的工作副本中包含與Pull請求中引入的階段性更改匹配的階段性更改:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: config.h
modified: osrng.h
git diff --cached
應該顯示與PR類似的差異。 這是因為git merge
的--squash
選項實際上並未創建新的提交(我的粗體):
產生工作樹和索引狀態,就像發生真正的合並一樣(合並信息除外),但實際上不進行提交 ,移動
HEAD
或記錄$GIT_DIR/MERGE_HEAD
( 以使下一個git commit
命令創建一個合並提交 )。 這使您可以在當前分支的頂部創建一個提交,其作用與合並另一個分支的作用相同(對於章魚,則更多)。
提交這些階段性的更改,然后推動。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.