问题描述
我做了一些蠢事......
- I fork &害羞;在GitHub上编辑回购。 >
- 我做了一些更改,提交和害羞;把它们放在我的分支上。 $ b $ b
原始仓库的所有者请求在我的代码中进行一些更改,然后他才能接受请求,我很乐意这样做。
我尝试重新分解回购,但是我无法检出拉取请求中的提交,它甚至没有作为未链接提交(提交不是任何分支或标签的一部分,我不知道官方术语)。
我的问题是:如何恢复提交作为拉取请求发送?
如果没有办法,重新执行新提交中的更改是一个选项,但拉取请求WO会丢失。
我的问题不是关于不会失去提交的更改,而是关于不丢失 git历史记录,这意味着保留提交的 SHA1 (以及其他任何我可能不知道)。
有可能。
如果没有链接到请求的请求,很难测试这是否可行,但您可以尝试创建
- 创建
- 克隆您的新分支,
-
fetch
你从上游存储库获取请求,git remote add upstream https://github.com/User/repository.git
$编辑器.git / config
#添加`fetch = + refs / pull / * / head:refs / remotes / upstream / pr / *`至
#相关部分,如链接页面中所述。请注意,
#我们使用`upstream`而不是`origin`作为目标。
git fetch upstream
-
合并
将请求拉入本地存储库,例如git checkout master
git merge - -ff-only upstream / pr / 1
-
然后
push
- I forked a repo on GitHub.
- I made some changes, committed them on my fork.
- I sent this commit as a pull-request back to the original repo.
- Here comes the stupid part: I deleted my fork.
- create a new fork of the repository,
- clone your new fork,
fetch
your pull request from the upstream repository,git remote add upstream https://github.com/User/repository.git $EDITOR .git/config # Add `fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*` to # the relevant section, as outlined in the linked page. Note that # we use `upstream` instead of `origin` as the target. git fetch upstream
merge
the pull request into your local repository, e.g.git checkout master git merge --ff-only upstream/pr/1
and then
push
it back to your new fork.
如果失败了,您可以提交支持请求GitHub要求他们恢复您的存储库。从:
要启动此过程,请尽快。
I did something stupid…
The owner of the original repo requested a couple changes in my code before he could accept the pull-request, which I'd gladly do.
I tried re-forking the repo, but I can't checkout the commit from the pull-request, it's not even there as an "unlinked" commit (a commit that is not part of any branch or tag, I don't know the official terminology).
My question is: How can I recover the commit sent as a pull-request ?
If there's no way, re-doing the changes in a new commit is an option, but the pull-request would be lost.My question is not about not losing the changes from the commit, it's about not losing the git history, meaning keeping the commit's SHA1 (and anything else I might not be aware of).
It is possible to fetch
pull requests to your local machine.
Without having a link to the pull request in question it's hard to test whether this will work, but you can try to
If that fails, you can submit a support request to GitHub asking them to restore your repository. From an FAQ about security:
To initiate this process, contact their support team as soon as possible.
这篇关于从GitHub上删除的叉上恢复作为拉取请求发送的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!