当我“git push”时,git 现在说“为……创建拉取请求”。为什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30518603/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
When I "git push" git now says "Create pull request for ...". Why?
提问by Mike Robinson
I am making changes to a project in a branch that, so far, is known to no one else but me. However, starting recently, when I git push
to this project, I now receive this as part of the response:
我正在对一个分支中的项目进行更改,到目前为止,除了我之外没有其他人知道。但是,从最近开始,当我git push
参与这个项目时,我现在收到了以下回复:
remote: Create pull request for <<my branch>>:
remote: https://bitbucket.org/...
I have no idea why Git is giving me this message, which I have never seen before.
我不知道为什么 Git 给我这条消息,这是我以前从未见过的。
Even if I deletethe remote branch (with "git push origin :<<my branch>>
" I now stillget this message! (I successfully deletedthe branch on the remote, but the message remains)
即使我删除了远程分支(使用“ git push origin :<<my branch>>
”我现在仍然收到此消息!(我成功删除了远程分支,但消息仍然存在)
回答by TimWolla
Note:These messages can be disabled now. See Jake's answer. Read along my answer for the technical explanation.
注意:现在可以禁用这些消息。见Hyman的回答。阅读我的回答以获得技术解释。
Everything that is prefixed by remote:
has been sent by the receiving script1on the server. Bitbucket probably wants to make it easier for you to create a pull request.
以 为前缀的remote:
所有内容都已由服务器上的接收脚本1发送。Bitbucket 可能想让您更轻松地创建拉取请求。
1Example of such a post-receive
hook using echo
to send a message to the user as explained in the link above. It will be called once all the pushed data is completely saved on the server:
1这种post-receive
钩子的示例echo
用于向用户发送消息,如上面链接中所述。一旦所有推送的数据完全保存在服务器上,它将被调用:
Both standard output and standard error output are forwarded to git send-pack on the other end, so you can simply echo messages for the user.
标准输出和标准错误输出都转发到另一端的 git send-pack,因此您可以简单地为用户回显消息。
On the server:
在服务器上:
[email protected]:~/stackoverflow.git/hooks$ cat post-receive
#!/bin/bash
echo "This is an example of a git hook running at the server"
On the client:
在客户端:
$ git push [email protected]:stackoverflow.git master:master
Counting objects: 1, done.
Writing objects: 100% (1/1), 187 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
remote: This is an example of a git hook running at the server
To [email protected]:stackoverflow.git
4751391..01882eb master -> master
回答by hdl
I think TimWolla is right, but I just wanted to add this post from Atlassian, which clarifies Atlassian's policy:
我认为 TimWolla 是对的,但我只是想添加来自 Atlassian 的这篇文章,它阐明了 Atlassian 的政策:
In Stash 3.3, a feature was added to display a message to users in the terminal with a link to create a pull request when a new branch or branch with no pull requests is pushed. This guide will explain how to turn this feature off.
remote: remote: Create pull request for ABC-123-fix-bug: remote: http://localhost:7990/projects/PROJ/repos/REPO/compare/commits?sourceBranch=refs/heads/ABC-123-fix-bug remote:
Currently this feature can only be turned on or off globally. [...]
To turn this feature off, do the following:
- Navigate to the 'Manage add-ons' section of the Stash admin screens
- Select 'System' from the dropdown
- Search for 'Bundled Hooks' expand it and its modules
- Find the 'print-branch-links-hook' module, click Disable
在 Stash 3.3 中,添加了一项功能,可以在推送没有拉取请求的新分支或分支时,向终端中的用户显示一条消息,其中包含创建拉取请求的链接。本指南将解释如何关闭此功能。
remote: remote: Create pull request for ABC-123-fix-bug: remote: http://localhost:7990/projects/PROJ/repos/REPO/compare/commits?sourceBranch=refs/heads/ABC-123-fix-bug remote:
目前此功能只能全局开启或关闭。[...]
要关闭此功能,请执行以下操作:
- 导航到 Stash 管理屏幕的“管理加载项”部分
- 从下拉菜单中选择“系统”
- 搜索“Bundled Hooks”展开它和它的模块
- 找到'print-branch-links-hook'模块,点击禁用
回答by Jake
TimWollaprovided the full explanation, but here is how to get it fixed in the long term: Provide your feedback on this support ticketto show that you share the frustration expressed by other users over this issue.
TimWolla提供了完整的解释,但这里是如何长期修复它:提供您对此支持票的反馈,以表明您和其他用户一样对这个问题表示失望。
UPDATE:As of 2016-09-27 this is no longer an issue and Atlassian has provided an official responseon the matter.
更新:截至 2016 年 9 月 27 日,这不再是问题,Atlassian 已对此事作出官方回应。
Here are the instructions for disabling these messages:
以下是禁用这些消息的说明:
- Log into BitBucket with your browser.
- Click on your user icon on the top-right corner of the window.
- Go to
BitBucket Settings
- Uncheck "Enable console messages."
- Press the "Update" button below.
- 使用浏览器登录 BitBucket。
- 单击窗口右上角的用户图标。
- 去
BitBucket Settings
- 取消选中“启用控制台消息”。
- 按下面的“更新”按钮。