Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.4k points)

I keep hearing people say they're forking the code in Git. Git "fork" sounds suspiciously like Git "clone" plus some (meaningless) psychological willingness to forgo future merges. There is no fork command in Git, right?

GitHub makes forks a little more real by stapling correspondence onto it. 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? Or any rumors of Git absorbing the functionality?

1 Answer

0 votes
by (27.5k points)

Clone: In case you just want to download it for personal use 

Fork to your GitHub repository and then clone that version: In case you want to contribute back the changes you've made. 

When you clone a GitHub repository on your native workstation, you can't contribute back to the upstream repository unless you're explicitly declared as "contributor".

That's because your clone could be 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:

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

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

Also. signal any fascinating contribution back to the original GitHub repository (that is the "pull request" part by means of the changes you made on your own GitHub repository)

Related questions

Browse Categories