git - 在 Stash 中 check out 一个 Pull Request

标签 git bitbucket-server

我正在尝试检查对本地开发框的 pull 请求,以便我可以对其进行一些测试。我找到了一些关于这样做的引用 here ,但我无法让它正常工作。

git fetch refs/pull-requests/$PR_NO/from:$LOCAL_BRANCH

我不确定应该用什么替换 $LOCAL_BRANCH。我试过“主人”,但我得到了下面的异常(exception)。

$ git fetch origin refs/pull-requests/30/from:master
fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository

正确的做法是什么?

最佳答案

所以 $LOCAL_BRANCH 可以是(几乎)任何你想要的 - 它会创建一个同名的新分支。因此,如果您愿意,可以将其称为“pr_30_from”。我假设您已在 master 分支上 checkout ,这就是您收到该错误的原因 - 这是您不能使用的名称。

如果可行,请告诉我。 查尔斯

附言。正如一句警告,您只能从打开的 pull 请求中获取(至少在 Stash 2.9+ 中)。如果“30”已被 merge/拒绝,您将无法再从中获取。

关于git - 在 Stash 中 check out 一个 Pull Request,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22540809/

相关文章:

Android Studio 备份源到存储库

git - 同时在多个仓库中创建 git 分支

linux - 带有 Web GUI 的免费 G​​IT 服务器,如 BitBucket/GitHub

git - 自动获取 pull 请求主题/主题

apache - 使用 Tomcat 使用 HTTPS 反向代理配置 Bitbucket Server 的问题

git - 如何防止git中未推送的子模块

python - 如何通过 gitpython 检查 Git Repo 是否有未提交的更改

Git rebase - 强制覆盖 merge 冲突

git - 在 bitbucket 远程服务器上发生冲突,但一切都是本地最新的

bitbucket-server - Bfg-repo-cleaner 工具成功但 repo 大小没有减少