[英]If I push a cloned repo, will it have everything that the cloned repo has?
I'm getting a bit confused with Git!我对 Git 有点困惑!
git-push MyNewRepoOnGitHub master
然后我做了一个git-push MyNewRepoOnGitHub master
Does MyNewRepoOnGitHub
have everything that I originally cloned? MyNewRepoOnGitHub
是否包含我最初克隆的所有内容? Can I send a pull request to the contributors of the project that I originally cloned?我可以向我最初克隆的项目的贡献者发送拉取请求吗? Or... am I being completely thick and need to reread what I thought I knew about Git?!或者......我是不是太厚了,需要重新阅读我认为我知道的关于 Git 的内容?!
Your new repository on github will only contain all commits reachable from master
(you only pushed master).您在 github 上的新存储库将仅包含可从master
访问的所有提交(您只推送了 master)。 To push all refs (including tags), use git push MyNewRepoOnGitHub --all
.要推送所有引用(包括标签),请使用git push MyNewRepoOnGitHub --all
。
I don't use github myself, but a pull request should be possible.我自己不使用 github,但应该可以使用拉取请求。 Commits don't change when cloned or pushed (but it could be possible that github requires you to 'fork' the project first).克隆或推送时提交不会更改(但 github 可能要求您首先“分叉”项目)。 Pulling and merging from your both your cloned repositories will definitely work (with plain git)从您的两个克隆存储库中提取和合并肯定会起作用(使用普通 git)
I think you will have to explicitly "fork" the original repo to raise a pull request.我认为您必须明确地“分叉”原始存储库以提出拉取请求。 Github currently doesn't know that your MyNewRepoOnGitHub
is related to the original repo you cloned from. Github 目前不知道您的MyNewRepoOnGitHub
与您从中克隆的原始存储库相关。 Forking establishes this relation and allows for pull requests to be raised to share commits.分叉建立了这种关系,并允许提出拉取请求以共享提交。
You can:你可以:
Setup the forked repo as an additional remote repository (for the existing cloned repo on your machine)将分叉的存储库设置为附加的远程存储库(用于您机器上现有的克隆存储库)
git remote add MyForkedRepo <url-to-your-forked-repo>
Push your changes to the forked repo将您的更改推送到分叉的仓库
git push MyForkedRepo master
Raise a pull request on Github在 Github 上提出拉取请求
Without forking there are two ways, albeit very ancient looking compared to the pull request approach,没有分叉,有两种方法,尽管与拉取请求方法相比看起来非常古老,
MyNewRepoOnGithub
as his remote and pull your changes and merge them and push them the original repo原始回购提交者/所有者必须将您的MyNewRepoOnGithub
添加为他的远程并提取您的更改并合并它们并将它们推送到原始回购
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.