Git 在通过 Bitbucket 合并拉取请求后以 "Your branch is ahead of 'origin/Dev' by 2 commits" 响应
Git responds with "Your branch is ahead of 'origin/Dev' by 2 commits" after merging a pull request through Bitbucket
我注意到一个问题,每次我在 bitbucket 中接受拉取请求并将功能分支合并到开发分支,然后返回到我的命令行并在我的内部执行 git pull
dev 分支,git 响应:
Your branch is ahead of 'origin/Dev' by 2 commits.
(use "git push" to publish your local commits)
我试过 git pull
、git pull origin
、git pull origin Dev
、git fetch
、git fetch origin
等
我该如何解决这个问题?
编辑:
如果我git push
清除状态,它会推送一个带有消息的提交:
Merge branch 'Dev' of https://bitbucket.org/foo/bar into Dev
我通过 bitbucket 执行的拉取请求合并有一条提交消息:
Merged in feature-branch-name (pull request #3) Some changelist commit message here
而且它们都有相同的时间戳。尽管我可能 git push
15 分钟后。
在您的开发分支中有两个提交(其中包含您之前使用 git 提交或 git 合并提交的本地文件更改)尚未推送到 origin/Dev。
解决它的最佳方法通常是“使用 "git push" 将您的本地提交复制到远程存储库,以便其他人可以拉取它们。
如果你想
- 摆脱这两个提交(及其所有更改)
- 摆脱本地工作树文件更改
- return 到 origin/Dev
的确切状态
使用这个命令(开始前确保你在你的开发分支)
git reset --hard origin/Dev
在此命令结束时,您的 dev/branch 和 origin/Dev 以及跟踪的本地文件将全部匹配。
Your branch is ahead of 'origin/Dev' by 2 commits.
这意味着您需要推送,而不是拉取或获取。
Merge branch 'Dev' of https://bitbucket.org/foo/bar into Dev
Merged in feature-branch-name (pull request #3) Some changelist commit message here
当您接受拉取请求时,这些提交是在本地创建的。他们的时间戳代表他们的创建日期(即你接受 PR 的时间)。
你可以在15分钟后或15天后推送,那个(创建)日期不会改变。
我注意到一个问题,每次我在 bitbucket 中接受拉取请求并将功能分支合并到开发分支,然后返回到我的命令行并在我的内部执行 git pull
dev 分支,git 响应:
Your branch is ahead of 'origin/Dev' by 2 commits.
(use "git push" to publish your local commits)
我试过 git pull
、git pull origin
、git pull origin Dev
、git fetch
、git fetch origin
等
我该如何解决这个问题?
编辑:
如果我git push
清除状态,它会推送一个带有消息的提交:
Merge branch 'Dev' of https://bitbucket.org/foo/bar into Dev
我通过 bitbucket 执行的拉取请求合并有一条提交消息:
Merged in feature-branch-name (pull request #3) Some changelist commit message here
而且它们都有相同的时间戳。尽管我可能 git push
15 分钟后。
在您的开发分支中有两个提交(其中包含您之前使用 git 提交或 git 合并提交的本地文件更改)尚未推送到 origin/Dev。
解决它的最佳方法通常是“使用 "git push" 将您的本地提交复制到远程存储库,以便其他人可以拉取它们。
如果你想
- 摆脱这两个提交(及其所有更改)
- 摆脱本地工作树文件更改
- return 到 origin/Dev 的确切状态
使用这个命令(开始前确保你在你的开发分支)
git reset --hard origin/Dev
在此命令结束时,您的 dev/branch 和 origin/Dev 以及跟踪的本地文件将全部匹配。
Your branch is ahead of 'origin/Dev' by 2 commits.
这意味着您需要推送,而不是拉取或获取。
Merge branch 'Dev' of https://bitbucket.org/foo/bar into Dev
Merged in feature-branch-name (pull request #3) Some changelist commit message here
当您接受拉取请求时,这些提交是在本地创建的。他们的时间戳代表他们的创建日期(即你接受 PR 的时间)。
你可以在15分钟后或15天后推送,那个(创建)日期不会改变。