Skip to main content

Fork A Repo

fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.
Most commonly, forks are used to either propose changes to someone else's project or to use someone else's project as a starting point for your own idea.
Propose changes to someone else's project
A great example of using forks to propose changes is for bug fixes. Rather than logging an issue for a bug you've found, you can:
  • Fork the repository.
  • Make the fix.
  • Submit a pull request to the project owner.
If the project owner likes your work, they might pull your fix into the original repository!
Use someone else's project as a starting point for your own idea.
At the heart of open source is the idea that by sharing code, we can make better, more reliable software.
In fact, when you create a repository on GitHub, you have a choice of automatically including a license file, which determines how you want your project to be shared with others.

Fork an example repository

Forking a repository is a simple two-step process. We've created a repository for you to practice with!
  1. On GitHub, navigate to the octocat/Spoon-Knife repository.
  2. Fork buttonIn the top-right corner of the page, click Fork.
That's it! Now, you have a fork of the original octocat/Spoon-Knife repository.

Keep your fork synced

You might fork a project in order to propose changes to the upstream, or original, repository. In this case, it's good practice to regularly sync your fork with the upstream repository. To do this, you'll need to use Git on the command line. You can practice setting the upstream repository using the same octocat/Spoon-Knife repository you just forked!

Step 1: Set Up Git

If you haven't yet, you should first set up Git. Don't forget to set up authentication to GitHub from Git as well.

Step 2: Create a local clone of your fork

Right now, you have a fork of the Spoon-Knife repository, but you don't have the files in that repository on your computer. Let's create a clone of your fork locally on your computer.
  1. On GitHub, navigate to your fork of the Spoon-Knife repository.
  2. Clone URL buttonIn the right sidebar of your fork's repository page, click  to copy the clone URL for your fork.
  3. Open Terminal (for Mac users) or the command prompt (for Windows and Linux users).
  4. Type git clone, and then paste the URL you copied in Step 2. It will look like this, with your GitHub username instead of YOUR-USERNAME:
    git clone https://github.com/YOUR-USERNAME/Spoon-Knife
    
  5. Press Enter. Your local clone will be created.
    git clone https://github.com/YOUR-USERNAME/Spoon-Knife
    # Cloning into `Spoon-Knife`...
    # remote: Counting objects: 10, done.
    # remote: Compressing objects: 100% (8/8), done.
    # remove: Total 10 (delta 1), reused 10 (delta 1)
    # Unpacking objects: 100% (10/10), done.
    
Now, you have a local copy of your fork of the Spoon-Knife repository!

Step 3: Configure Git to sync your fork with the original Spoon-Knife repository

When you fork a project in order to propose changes to the original repository, you can configure Git to pull changes from the original, or upstream, repository into the local clone of your fork.
  1. On GitHub, navigate to the octocat/Spoon-Knife repository.
  2. Clone URL buttonIn the right sidebar of the repository page, click  to copy the clone URL for the repository.
    1. Open Terminal (for Mac users) or the command prompt (for Windows and Linux users).
  3. Change directories to the location of the fork you cloned in Step 2: Create a local clone of your fork.
    • To go to your home directory, type just cd with no other text.
    • To list the files and folders in your current directory, type ls.
    • To go into one of your listed directories, type cd your_listed_directory.
    • To go up one directory, type cd ...
  4. Type git remote -v and press Enter. You'll see the current configured remote repository for your fork.
    git remote -v
    # origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
    # origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
    
  5. Type git remote add upstream, and then paste the URL you copied in Step 2 and pressEnter. It will look like this:
    git remote add upstream https://github.com/octocat/Spoon-Knife.git
    
  6. To verify the new upstream repository you've specified for your fork, type git remote -vagain. You should see the URL for your fork as origin, and the URL for the original repository as upstream.
    git remote -v
    # origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
    # origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
    # upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
    # upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
    
Now, you can keep your fork synced with the upstream repository with a few Git commands. For more information, see "Syncing a fork."

Next Steps

The sky's the limit with the changes you can make to a fork, including:
  • Creating branches: Branches allow you to build new features or test out ideas without putting your main project at risk.
  • Opening pull requests: If you are hoping to contribute back to the original repository, you can send a request to the original author to pull your fork into their repository by submitting a pull request.

Find another repository to fork

Every public repository can be forked, so find another project you're interested in and get forking!
Explore GitHub is a great place to find projects that pique your interest. Visit that page often to see what's new and cool.
GitHub Explore page

Celebrate

You have now forked a repository, practiced cloning your fork, and configured an upstream repository. What do you want to do next?

Comments

Popular posts from this blog

fix idm integration on chrome

Chrome Browser Integration I do not see IDM extension in Chrome extensions list. How can I install it?  How to configure IDM extension for Chrome? Please note that all IDM extensions that can be found in Google Store are fake and should not be used. You need to install IDM extension manually from IDM installation folder. Read in step 2 how to do it . 1. Please update IDM to the latest version by using  "IDM Help->Check for updates..."  menu item 2.  I don't see  "IDM Integration module"  extension in the list of extensions in  Chrome . How can I install it? Press on  Chrome  menu ( arrow 1  on the image), select  "Settings"  menu item ( arrow 2  on the image) and then select  "Extensions"  tab ( arrow 3  on the image). After this open IDM installation folder ( "C:\Program Files (x86)\Internet Download Manager"  by default,  arrow 4  on the image) and drag and drop  "IDMGCExt.crx"  ( arrow 5  on the image) file int

Hidden Wiki

Welcome to The Hidden Wiki New hidden wiki url 2015 http://zqktlwi4fecvo6ri.onion Add it to bookmarks and spread it!!! Editor's picks Bored? Pick a random page from the article index and replace one of these slots with it. The Matrix - Very nice to read. How to Exit the Matrix - Learn how to Protect yourself and your rights, online and off. Verifying PGP signatures - A short and simple how-to guide. In Praise Of Hawala - Anonymous informal value transfer system. Volunteer Here are five different things that you can help us out with. Plunder other hidden service lists for links and place them here! File the SnapBBSIndex links wherever they go. Set external links to HTTPS where available, good certificate, and same content. Care to start recording onionland's history? Check out Onionland's Museum Perform Dead Services Duties. Introduction Points Ahmia.fi - Clearnet search engine for Tor Hidden Services (allows you

Explainer: The nico-teen brain

Explainer: The nico-teen brain The adolescent brain is especially vulnerable to the addictive effects of nicotine BY  TERESA SHIPLEY FELDHAUSEN   7:00AM, AUGUST 19, 2015 Nicotine (black triangle towards center left) tricks the nerve cell (neuron) into sending a message to release more dopamine (yellow dots). Those molecules enter the space (synapse) between one nerve cell and the next. When they get picked up by neighboring cells, this gives users a feel-good high. It also creates the risk of addiction and other health problems.  EMail  Print  Twitter  Facebook  Reddit  Google+ NATIONAL INSTITUTE ON DRUG ABUSE, ADAPTED BY J. HIRSHFELD Nicotine is the addictive chemical in tobacco smoke and e-cigarette vapors. And doctors say the teenage brain is no place for it to end up. Nicotine can reach the brain within seven seconds of puffing on a cigar, hookah, cigarette or electronic cigarette. The area of the brain responsible f