我找到了这个要点:https: //gist.github.com/kennethreitz/3709868
我正在使用bitbucket,我正在寻找类似的功能.
你能帮助我吗?谢谢
Duc*_*035 16
可以使用以下方法从Bitbucket Server的pull请求中获取代码:
git fetch origin refs/pull-requests/$PR_NO/from:$LOCAL_BRANCH
Run Code Online (Sandbox Code Playgroud)
zmo*_*zmo 15
我找到了这个答案,并认为实际上可以获取bitbucket上的pull请求的refs.
但事实并非如此.
对于OP的问题的答案是,这是不可能的:还有的是关于它的开放功能请求的问题是一直无人接听,无人值守的4 5 SIX年.
解决方法?
您可以将PR作为可下载的.patch可下载文件获取并应用于您手动创建的新分支.但是您无法轻松应用更新.
我想出了另一条出路,我已经在git-repo中实现了,所以每个人都可以使用它.我正在做的是使用API来获取PR的远程和分支,并自动在本地创建新的上游和分支.这样你就可以从PR海报上获得更新.缺点是git遥控器的混乱.
This works for bitbucket. Other server could have different refs: (refspecs) or no refs: at all.
First of all you need to add the pull request refs: of the remote repository. To do that to a repository (e.g. aliased 'upstream'):
git config --add remote.upstream.fetch '+refs/pull-requests/*/from:refs/remotes/upstream/pull-requests/*'
Run Code Online (Sandbox Code Playgroud)
That is, you add the last line on git .config file:
[remote "origin"]
url = ssh://git@git.blablabla.net/~user/repository.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull/*/head:refs/remotes/origin/pull-requests/*
Run Code Online (Sandbox Code Playgroud)
Then if you perform the remote fetch you should see the retrieval of (also) all the pull requests:
git fetch upstream
From ssh://git.blablabla.net/somepath/repository
* [new ref] refs/pull-requests/1188/from -> upstream/pull-requests/1188
* [new ref] refs/pull-requests/1741/from -> upstream/pull-requests/1741
* [new ref] refs/pull-requests/2394/from -> upstream/pull-requests/2394
Run Code Online (Sandbox Code Playgroud)
Finally you can checkout the pull-request you prefer:
git checkout pull-requests/2723
Run Code Online (Sandbox Code Playgroud)
Successfully tested on dedicated bitbucket server 27/02/19.
小智 7
我遵循了这篇文章Pull request Fetching。
它起作用了,但是我发现我只需要在当前仓库中添加一行,而不是创建一个民间仓库和一个上游仓库。运行这条线
git config --add remote.origin.fetch '+refs/pull-requests/*/from:refs/remotes/origin/pr/*'
您也可以将其手动添加到项目中的.git / config文件中。
下次运行时,git pull您应该会看到一个列表:
然后,您可以运行git checkout origin/pr/666以获取拉取请求更改。
| 归档时间: |
|
| 查看次数: |
10215 次 |
| 最近记录: |