为什么 Git 不推动合并?
Why is Git not push'ing a merge?
我正在尝试合并 this pull request。我执行了以下步骤(直接取自 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 returns:
$ 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
$
我确认我在 Master:
$ git branch
* master
noloader-master
wyattoday-fix-junk-defines
为什么 Git 不推动合并?我该如何解决这个问题?
如果你 运行 git status
我相信你会发现你的工作副本包含与拉取请求中引入的那些相匹配的分阶段更改:
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 相似的差异。这是因为 --squash
option to git merge
,它实际上并没有创建新的提交(我的粗体):
Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit, move the HEAD
, or record $GIT_DIR/MERGE_HEAD
(to cause the next git commit
command to create a merge commit). This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus).
提交那些暂存的更改,然后推送。
我正在尝试合并 this pull request。我执行了以下步骤(直接取自 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 returns:
$ 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
$
我确认我在 Master:
$ git branch
* master
noloader-master
wyattoday-fix-junk-defines
为什么 Git 不推动合并?我该如何解决这个问题?
如果你 运行 git status
我相信你会发现你的工作副本包含与拉取请求中引入的那些相匹配的分阶段更改:
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 相似的差异。这是因为 --squash
option to git merge
,它实际上并没有创建新的提交(我的粗体):
Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit, move the
HEAD
, or record$GIT_DIR/MERGE_HEAD
(to cause the nextgit commit
command to create a merge commit). This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus).
提交那些暂存的更改,然后推送。