Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
412 views
in Technique[技术] by (71.8m points)

git - Git叉子实际上是Git克隆吗?(Are Git forks actually Git clones?)

I keep hearing people say they're forking code in Git.

(我一直听到有人说他们在Git中提供代码。)

Git "fork" sounds suspiciously like Git "clone" plus some (meaningless) psychological willingness to forgo future merges.

(Git“fork”听起来像Git“克隆”,还有一些(毫无意义的)放弃未来合并的心理意愿。)

There is no fork command in Git, right?

(Git中没有fork命令,对吧?)

GitHub makes forks a little more real by stapling correspondence onto it.

(GitHub通过将对应关系固定到它上来使叉子变得更加真实。)

That is, you press the fork button and later, when you press the pull request button, the system is smart enough to email the owner.

(也就是说,您按下前叉按钮后,当您按下拉取请求按钮时,系统足够智能,可以通过电子邮件发送给所有者。)

Hence, it's a little bit of a dance around repository ownership and permissions.

(因此,它是围绕存储库所有权和权限的一点点舞蹈。)

Yes/No?

(是/否?)

Any angst over GitHub extending Git in this direction?

(对GitHub的任何焦虑都会向这个方向扩展Git?)

Or any rumors of Git absorbing the functionality?

(或者Git吸收功能的任何谣言?)

  ask by Brian translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Fork , in the GitHub context, doesn't extend Git.

(在GitHub上下文中, Fork不会扩展Git。)
It only allows clone on the server side.

(它只允许在服务器端克隆。)

When you clone a GitHub repository on your local workstation, you cannot contribute back to the upstream repository unless you are explicitly declared as "contributor".

(在本地工作站上克隆GitHub存储库时,除非明确声明为“贡献者”,否则无法返回上游存储库。)

That's because your clone is a separate instance of that project.

(那是因为你的克隆是该项目的一个单独的实例。)

If you want to contribute to the project, you can use forking to do it, in the following way:

(如果您想为项目做出贡献,可以通过以下方式使用分叉来执行此操作:)

  • clone that GitHub repository on your GitHub account (that is the "fork" part , a clone on the server side)

    (克隆你的GitHub帐户上的GitHub存储库(即“fork”部分 ,服务器端的克隆))

  • contribute commits to that GitHub repository (it is in your own GitHub account, so you have every right to push to it)

    (贡献对GitHub存储库的提交(它在你自己的GitHub帐户中,所以你有权利推送它))

  • signal any interesting contribution back to the original GitHub repository (that is the "pull request" part by way of the changes you made on your own GitHub repository)

    (将任何有趣的贡献发送回原始的GitHub存储库(即通过您在自己的GitHub存储库上所做的更改的“拉取请求”部分 ))

Check also " Collaborative GitHub Workflow ".

(另请参阅Collaborative GitHub Workflow ”。)

If you want to keep a link with the original repository (also called upstream), you need to add a remote referring that original repository.

(如果要保留与原始存储库(也称为上游)的链接,则需要添加引用该原始存储库的远程数据库。)
See " What is the difference between origin and upstream on GitHub? "

(请参阅“ GitHub上的源和上游有什么区别? ”)

叉和上游

And with Git 2.20 (Q4 2018) and more, fetching from fork is more efficient, with delta islands .

(使用Git 2.20(2018年第四季度)以及更多, 使用delta岛更有效率。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...