我分叉了一个项目,进行了更改,并创建了一个被接受的拉取请求。新的提交后来被添加到存储库中。我怎样才能把这些承诺交给我?


当前回答

从github页面删除远程设备

然后应用这些命令:

1) git branch -D dev
2) git fetch upstream
3) git checkout master
4) git fetch upstream && git fetch upstream --prune && git rebase upstream/master && git push -f origin master
5) git checkout -b dev
6) git push origin dev
7) git fetch upstream && git fetch upstream --prune && git rebase upstream/dev && 8) git push -f origin dev

要查看配置,请使用以下命令:

git remote -v

其他回答

我用这一行更新我的分叉回购:

git pull https://github.com/forkuser/forkedrepo.git branch

如果您不想在项目中添加另一个远程端点,请使用此选项,如其他解决方案所示。

克隆分叉存储库后,转到克隆所在的目录路径和GitBash终端中的几行。

$ cd project-name

$ git remote add upstream https://github.com/user-name/project-name.git
 # Adding the upstream -> the main repo with which you wanna sync

$ git remote -v # you will see the upstream here 

$ git checkout master # see if you are already on master branch

$ git fetch upstream

你很好去那里。主存储库中所有更新的更改都将被推送到您的fork存储库中。

“fetch”命令对于保持项目中的最新状态是必不可少的:只有在执行“gitfetch”时,您才会被告知同事对远程服务器所做的更改。

您仍然可以访问此处进行进一步查询

从github页面删除远程设备

然后应用这些命令:

1) git branch -D dev
2) git fetch upstream
3) git checkout master
4) git fetch upstream && git fetch upstream --prune && git rebase upstream/master && git push -f origin master
5) git checkout -b dev
6) git push origin dev
7) git fetch upstream && git fetch upstream --prune && git rebase upstream/dev && 8) git push -f origin dev

要查看配置,请使用以下命令:

git remote -v
rm -rf oldrepository
git clone ...

可能有更微妙的选项,但这是我唯一有信心的方法,我的本地存储库与上游存储库相同。

“拉”应用程序是一个自动设置和忘记的解决方案。它将使fork的默认分支与上游存储库同步。

访问URL,单击绿色的“安装”按钮,然后选择要启用自动同步的存储库。

分支每小时在GitHub上直接更新一次,在本地计算机上,您需要拉动主分支以确保本地副本同步。