git 删除本地分支时推送打开的 PR
git push in the open PR when local branch of it deleted
我在上游创建了一个拉取请求,其中有一个名为 eg 的分支。 testbranch
现在,不幸的是,我本地的整个 git
文件夹都被删除了。
我在我的本地创建了一个新的 git
,当我执行 git branch
时,我只能看到 master
我发现我需要将一些提交推送到开放 PR。但是随着本地分支被删除,我该怎么做呢?有什么方法可以在我的本地终端上重新创建 origin 分支并且我可以将提交推送到 PR?
谢谢。
嗯,首先你需要克隆那个存储库。
然后你只需要在本地签出远程分支,进行更改,提交并推送到远程分支。
克隆远程分支后,假设将远程添加为源,执行 -
git checkout -b feature_branch --track origin/feature_branch
然后进行更改,提交,然后git push
应该将新提交添加到远程分支
这些步骤帮助我推动了最初的 Open PR
git checkout upstream/master -b new_branch
(I gave the same branch name I used for the PR)
git pull origin branch_name (where I've created a PR).
-- 进行更改 --
git pull --rebase upstream master // rebase your branch to avoid merge conflicts
git commit -a -m "message" // commit your work
git push origin current_branch // push the changes to the github
新更改已成功添加为现有 PR 的新提交
我在上游创建了一个拉取请求,其中有一个名为 eg 的分支。 testbranch
现在,不幸的是,我本地的整个 git
文件夹都被删除了。
我在我的本地创建了一个新的 git
,当我执行 git branch
master
我发现我需要将一些提交推送到开放 PR。但是随着本地分支被删除,我该怎么做呢?有什么方法可以在我的本地终端上重新创建 origin 分支并且我可以将提交推送到 PR?
谢谢。
嗯,首先你需要克隆那个存储库。
然后你只需要在本地签出远程分支,进行更改,提交并推送到远程分支。
克隆远程分支后,假设将远程添加为源,执行 -
git checkout -b feature_branch --track origin/feature_branch
然后进行更改,提交,然后git push
应该将新提交添加到远程分支
这些步骤帮助我推动了最初的 Open PR
git checkout upstream/master -b new_branch
(I gave the same branch name I used for the PR)
git pull origin branch_name (where I've created a PR).
-- 进行更改 --
git pull --rebase upstream master // rebase your branch to avoid merge conflicts
git commit -a -m "message" // commit your work
git push origin current_branch // push the changes to the github
新更改已成功添加为现有 PR 的新提交