From 4958b3e6d038acfbad8b974ed927f10f62f8b17c Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Tue, 22 Feb 2011 18:39:40 -0800 Subject: Added bootcamp files --- _posts/2011-02-17-fork-a-repo.markdown | 79 ++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 _posts/2011-02-17-fork-a-repo.markdown (limited to '_posts/2011-02-17-fork-a-repo.markdown') diff --git a/_posts/2011-02-17-fork-a-repo.markdown b/_posts/2011-02-17-fork-a-repo.markdown new file mode 100644 index 0000000..4e8878c --- /dev/null +++ b/_posts/2011-02-17-fork-a-repo.markdown @@ -0,0 +1,79 @@ +--- +layout: default +title: Fork A Repo +description: Copy a repo to create a new, unique project from its contents. +categories: bootcamp +main_category: bootcamp +--- + +If you’ve found yourself on this page, we’re assuming you’re brand new to Git and GitHub. At some point you may want use another user’s project as the starting point for your own. This is known as "forking." + +##First: Fork A Repo + +For this tutorial, we'll be using the Fork It project. + +1. Fork the “Fork It ” repo + + To fork this project, click the "Fork" button. + + Click “Fork + +##Next: Set Up Your Local Repo + +You’ve successfully forked the Fork It repo, but so far it only exists on GitHub. To be able to work on the project, you will need to clone it to your local machine. + +1. Clone the “Fork It ” project + + Run the following code: + +
+	$ git clone git@github.com:octocat/Fork-it.gitClones the linked repo into the current folder
+	
+ +2. Configure remotes + + Each repository has a default remote* called `origin`. The origin remote in your new cloned repo points to your fork on GitHub, not the original repo it was forked from. To help you keep track of the original repo, you will add another remote named `upstream`: + +
+	$ cd Fork-itChanges the active directory in the prompt to the newly cloned "Fork-it" directory
+	$ git remote add upstream git://github.com/octocat/Fork-it.gitCreates a remote called "upstream" and assigns it the original repo URL
+	$ git fetch upstreamPulls in any changes not present in your local repository, but doesn't modify your working files
+	
+ + *A “remote” is a reference to the GitHub URL where your commits are stored. + +##Then: More Things You Can Do + +Congratulations, you’ve successfully forked a repo, but get a load of these other cool things you can do: + +- Push commits + + Once you’ve made some commits to a forked repo and want to push it to your forked project, you do it the same way you would with a regular repo: + +
+	$ git push origin masterPushes commits to GitHub
+	
+ +- Pull in upstream changes + + If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code: + +
+	$ git fetch upstreamFetches any new changes from the original repo
+	$ git merge upstream/masterMerges any changes fetched into your working files
+	
+ +- Pull requests + + If you are hoping to contribute back to the original fork, you can send the original author a [pull request](/pull-requests/). + +##Lastly: Celebrate + +You have now created forked a repo. What do you want to do next? + +
    +
  1. Set Up Git
  2. +
  3. Create A Repository
  4. +
  5. Fork A Repository
  6. +
  7. Be Social
  8. +
\ No newline at end of file -- cgit v1.3.1