[英]Why is Git not push'ing a merge?
I'm trying to merge this pull request . 我正在尝试合并此请求请求 。 I performed the following steps (taken directly from Bash history): 我执行了以下步骤(直接取自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
I tried to push with both a git push origin master
and git push
. 我试图同时使用git push origin master
和git push
。 In both cases Git returns: 在两种情况下,Git都会返回:
$ git push origin master
Username for 'https://github.com': noloader
Password for 'https://noloader@github.com':
Everything up-to-date
Everything cannot be up-to-date because I merged the patch. 由于我合并了补丁程序,因此所有内容都不是最新的。 After the change I am not seeing the code that was removed: 更改后,我看不到已删除的代码:
$ grep WORKAROUND_MS_BUG_Q258000 *.h *.cpp
$
I verified I am on Master: 我确认自己在师父上:
$ git branch
* master
noloader-master
wyattoday-fix-junk-defines
Why is Git not push'ing a merge? 为什么Git不推送合并? How do I work around the problem? 我该如何解决该问题?
If you run git status
I believe you'll find that your working copy includes staged changes matching those introduced in the pull request: 如果您运行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
should show diffs that similarly match the PR. git diff --cached
应该显示与PR类似的差异。 This is because of the --squash
option to git merge
, which doesn't actually create a new commit (my bold): 这是因为git merge
的--squash
选项实际上并未创建新的提交(我的粗体):
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 ). 产生工作树和索引状态,就像发生真正的合并一样(合并信息除外),但实际上不进行提交 ,移动HEAD
或记录$GIT_DIR/MERGE_HEAD
( 以使下一个git 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). 这使您可以在当前分支的顶部创建一个提交,其作用与合并另一个分支的作用相同(对于章鱼,则更多)。
Commit those staged changes, then push. 提交这些阶段性的更改,然后推动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.