[英]How do I get commits from origin into my local branch?
I have a fork ("origin") of a project on github ("upstream").我在github(“上游”)上有一个项目的分支(“起源”)。 I have a branch (
mybranch
), which I pushed to origin and created a pull request from.我有一个分支(
mybranch
),我将其推送到 origin 并从中创建了一个拉取请求。
Now, someone pushed to my branch on my fork.现在,有人用我的叉子推到了我的分支。 This means,
mybranch
on origin is ahead of my local mybranch
by x commits.这意味着,
mybranch
上的mybranch
比我本地的mybranch
领先x 次提交。
How do I get those commits into my local branch, as single commits.我如何将这些提交作为单个提交放入我的本地分支。
I've seen solutions of deleting my local branch and using git reset --hard origin/master
, but that just doesn't feel right.我已经看到了删除本地分支并使用
git reset --hard origin/master
解决方案,但这感觉不对。 Is there a more natural solution?有没有更自然的解决方案?
someone pushed to my branch on my fork.
有人用我的叉子推到我的树枝上。 This means, mybranch on origin is ahead of my local mybranch by x commits.
这意味着,起源上的 mybranch 比我本地的 mybranch 领先 x 次提交。
Then a simple git pull --rebase
is enough: it will update your local branch with the remote ones, and replay any local commits (done on your local branch but not yet pushed) on top of those new commits.然后一个简单的
git pull --rebase
就足够了:它将使用远程分支更新您的本地分支,并在这些新提交之上重放任何本地提交(在您的本地分支上完成但尚未推送)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.