From 9daf8363660584647d2c38f5b1ce7c664db1d5cb Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Mon, 28 Feb 2011 14:26:03 -0800 Subject: added more definitions/explanations --- _posts/2011-02-16-create-a-repo.markdown | 50 ++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) (limited to '_posts/2011-02-16-create-a-repo.markdown') diff --git a/_posts/2011-02-16-create-a-repo.markdown b/_posts/2011-02-16-create-a-repo.markdown index cba62d8..fb67672 100644 --- a/_posts/2011-02-16-create-a-repo.markdown +++ b/_posts/2011-02-16-create-a-repo.markdown @@ -6,11 +6,20 @@ categories: bootcamp main_category: bootcamp --- -If you’ve found yourself on this page, we’re assuming you’re brand new to Git and GitHub. This guide will walk you through creating your first repo, creating a README file, and making your first commit. +If you’ve found yourself on this page, we’re assuming you’re brand new to Git and GitHub. This guide will walk you through the basics and explain a little bit about how everything works along the way. ##First: Create A Repo -Every time you push your commits to GitHub, they get stored in a repository (a.k.a. “repo”) +Every time you make a commit with Git, it is stored in a repository (a.k.a. “repo”). To put your project up on GitHub, you’ll need to have a GitHub repository for it to live in. + +
+

More about repositories

+
+

+ Git stores all of your project files in a repository. If you are able to view hidden files on your system, you’ll see a subdirectory called “.git” in the project directory where you run git init. This is where Git stores all of your commits, as well as everything else it needs. In addition to your local, you can also have remote repositories (like GitHub repos). Remote repositories are the same as your local repo, but stored on a different server or computer for easy collaboration, backup, and general awesomeness. +

+
+
1. Create a new repo @@ -28,6 +37,15 @@ Every time you push your commits to GitHub, they get stored in a repository (a.k While a README isn’t a required part of a GitHub repo, it is a good idea to have one. READMEs are a great place to describe your project or add some documentation such as how to install or use your project. +
+

More about READMEs

+
+

+ If you include a file with the filename “README” in your repo, it will automatically be shown on your repo’s front page. Pretty cool, huh? GitHub supports a number of different README formats. The one in this tutorial will result in a basic text file but other formats like .markdown or .textile can be used to render HTML content like links and headers. For more info about the supported markup formats, check out the github markup repo. +

+
+
+ 1. Create the README file In the prompt, type the following code: @@ -37,14 +55,23 @@ While a README isn’t a required part of a GitHub repo, it is a good idea t $ cd ~/Hello-WorldChanges the current working directory to your newly created directory $ git initSets up the necessary Git files Initialized empty Git repository in /Users/your_user_directory/Hello-World/.git/ - $ touch READMECreates a file called "README" in your Hello-World directory + $ touch READMECreates a file called “README” in your Hello-World directory - Open the new README file found in your Hello-World directory in a text editor and add the text “Hello World!.” When you are finished, save and close the file. + Open the new README file found in your Hello-World directory in a text editor and add the text “Hello World!” When you are finished, save and close the file. 2. Commit your README - Now that you have your README set up, it's time to commit it. A commit is essentially a snapshot of all the files in your project at a particular point in time. In the prompt, type the following code: + Now that you have your README set up, it“s time to commit it. A commit is essentially a snapshot of all the files in your project at a particular point in time. In the prompt, type the following code: + +
+

More about commits

+
+

+ Think of a commit as a snapshot of your project —code, files, everything — at a particular point in time. More accurately, after your first commit, each subsequent commit is only a snapshot of your changes. For code files, this means it only takes a snapshot of the lines of code that have changed. For everything else like music or image files, it saves a new copy of the file. +

+
+
 	$ git add READMEStages your README file, adding it to the list of files to be committed
@@ -53,6 +80,19 @@ While a README isn’t a required part of a GitHub repo, it is a good idea t
 	
 	The code above executes actions locally, meaning you still haven’t done anything on GitHub yet. To connect your local repository to your GitHub account, you will need to set a remote for your repo and push your commits to it:
 	
+	
+

More about remotes

+
+

+ A remote is a repo stored on another computer, in this case on GitHub’s server. It is standard practice (and also the default in some cases) to give the name origin to the remote that points to your main offsite repo (for example, your GitHub repo). +

+

+ Git supports multiple remotes. This is commonly used when forking a repo. +

+
+
+ +
 	$ git remote add origin git@github.com:username/Hello-World.gitSets the origin for the Hello-World repo
 	$ git push origin masterSends your commit to GitHub
-- 
cgit v1.3.1