Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jessica Lord
committed
Jul 5, 2014
1 parent
f64c426
commit 40817a1
Showing
14 changed files
with
625 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<p> Create a new branch for your contribution.</p> | ||
<hr> | ||
<p> Git repositories use branches to isolate work when needed. It's | ||
common practice when working on a project or with others on a | ||
project to create a {bold}branch{/bold} to put your changes in. This | ||
way you can do your work while the main, commonly named 'master', | ||
branch stays stable.</p> | ||
<p> {cyan}GitHub Pages{/cyan}</p> | ||
<p> GitHub.com will automatically serve and host static website files in | ||
branches named 'gh-pages'. Since the project you forked creates a | ||
website, its main branch is 'gh-pages'. All sites like this can be | ||
found using this pattern for the URL: </p> | ||
<p> <a href="http://githubusername.github.io/repositoryname">http://githubusername.github.io/repositoryname</a></p> | ||
<p> {bold}{cyan} | ||
Create a branch{/bold} | ||
---------------{/cyan}</p> | ||
<p> When you create a branch, Git copies everything from the current | ||
branch you're on and places it in the branch you've requested.</p> | ||
<p> Type <code>git status</code> to see what branch you're currently on (it | ||
should be 'gh-pages')</p> | ||
<p> Create a branch and name it "add-<username>", where 'username' is | ||
your username. For instance, "add-jlord". </p> | ||
<p> $ git branch <BRANCHNAME></p> | ||
<p> Now you have a branch with a new name identical to 'gh-pages'.</p> | ||
<p> To go into that branch and work on it, similar to using <code>cd</code> to | ||
change directory in terminal, you {bold}checkout{/bold} a branch.</p> | ||
<p> $ git checkout <BRANCHNAME></p> | ||
<p> {bold}{cyan} | ||
Create a new file{/bold} | ||
--------------------------{/cyan}</p> | ||
<p> Back to the text editor. In the 'contributors' folder, create a | ||
new file named "add-<username>.txt", where 'username' is your | ||
username. For instance, "add-jlord.txt". Then, just write your | ||
GitHub username in it, that's it and that's all. For instance, | ||
I'd type 'jlord' and hit save. </p> | ||
<p> {bold}{cyan} | ||
Check-in{/bold} | ||
--------{/cyan}</p> | ||
<p> Go through the steps for checking in a project: </p> | ||
<p> $ git status | ||
$ git add <filename> | ||
$ git commit -m "commit message"</p> | ||
<p> Now push your update to your fork on GitHub:</p> | ||
<p> $ git push origin <BRANCHNAME></p> | ||
<p> Type <code>git-it verify</code> when you're done.</p> | ||
<p> {cyan}</p> | ||
<h2 id="-git-tips-"> <strong>GIT TIPS</strong></h2> | ||
<p> You can create and switch to a branch in one line:</p> | ||
<p> $ git checkout -b <BRANCHNAME></p> | ||
<p> Create a new branch:</p> | ||
<p> $ git branch <BRANCHNAME></p> | ||
<p> Move onto a branch:</p> | ||
<p> $ git checkout <BRANCHNAME></p> | ||
<p> List the branches:</p> | ||
<p> $ git branch</p> | ||
<p> Rename a branch you're currently on:</p> | ||
<p> $ git branch -m <NEWBRANCHNAME></p> | ||
<p> Verify what branch you're working on</p> | ||
<p> $ git status{/cyan}</p> | ||
<hr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<p> Create a file in your new repository, add something to that file and | ||
commit those changes to Git.</p> | ||
<hr> | ||
<p> Now that you've got a repository started, add a file to it. </p> | ||
<p> {bold}{cyan} | ||
New File{/bold} | ||
--------{/cyan}</p> | ||
<p> Open a text editor. Now write a couple of lines of text, perhaps | ||
describe the tastiest sandwich you can imagine, and save the | ||
file as <code>readme.md</code> in the folder you created in the last lesson.</p> | ||
<p> {bold}{cyan} | ||
Check, Add and Commit Changes{/bold} | ||
-----------------------------{/cyan}</p> | ||
<p> Next check the {bold}status{/bold} of your repository. Below in this terminal, | ||
you should still be within the new folder you created. See if there | ||
are changes listed:</p> | ||
<p> $ git status</p> | ||
<p> Then {bold}add{/bold} the file you just created to the files you'd | ||
like to {bold}commit{/bold} (aka save) to change. </p> | ||
<p> $ git add readme.md</p> | ||
<p> Finally, {bold}commit{/bold} those changes to the repository's history with a | ||
short description of the updates. See the command hints below!</p> | ||
<p> $ git commit -m "your commit message"</p> | ||
<p> {bold}{cyan} | ||
Make More Changes{/bold} | ||
-----------------------------{/cyan}</p> | ||
<p> Now add another line to <code>readme.md</code>, perhaps a title, and save.</p> | ||
<p> In terminal, you can view the {bold}diff{/bold}erence between the | ||
file now and how it was at your last commit. </p> | ||
<p> $ git diff</p> | ||
<p> Now with what you just learned above, commit this latest change.</p> | ||
<p> When all changes are committed, run <code>git-it verify</code>.</p> | ||
<p> {cyan}</p> | ||
<h2 id="-git-tips-"> <strong>GIT TIPS</strong></h2> | ||
<p> {bold}Check status of changes to a repository{/bold}</p> | ||
<p> $ git status</p> | ||
<p> {bold}View changes to files{/bold}</p> | ||
<p> $ git diff</p> | ||
<p> {bold}Add a file's changes to be committed{/bold}</p> | ||
<p> $ git add <FILENAME></p> | ||
<p> {bold}To add all files' changes{/bold}</p> | ||
<p> $ git add .</p> | ||
<p> {bold}To commit (aka save) the changes you've added with a short | ||
message describing the changes{/bold}</p> | ||
<p> $ git commit -m "your commit message"{/cyan}</p> | ||
<hr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<p> Fork a project from GitHub.com and clone it locally.</p> | ||
<hr> | ||
<p> Now you've made a project locally and pushed it to GitHub, but that's | ||
only half the fun. The other half is working with other people and | ||
projects.</p> | ||
<p> When you {bold}fork{/bold} a repository, you're creating a copy of it on | ||
your GitHub.com account. Forks are used for creating your own | ||
version of a project or contributing back fixes or features to the | ||
original project. </p> | ||
<p> Once a project is forked, you then {bold}clone{/bold} (aka copy) it from | ||
GitHub to your computer to work on locally.</p> | ||
<p> {bold}{cyan} | ||
Fork{/bold} | ||
----{/cyan}</p> | ||
<p> The project we'll work with is {bold}www.github.com/jlord/patchwork{/bold}. Go | ||
to that site and click the fork button at the top right. Once the | ||
fork animation is complete, you've got a copy on your account. Copy | ||
your fork's HTTP URL on the right side.</p> | ||
<p> {bold}{cyan} | ||
Clone a Repository{/bold} | ||
-------------------{/cyan}</p> | ||
<p> Now, in terminal, clone the repository. It will create a new folder | ||
for the repository so no need to create one. But make sure you aren't | ||
cloning it inside of another Git repository folder! So, if you're still | ||
inside of the repository you created in the early challenges, | ||
back out of that folder: <code>cd ..</code></p> | ||
<p> $ git clone <URL></p> | ||
<p> Navigate into that folder (in this case, named 'patchwork')</p> | ||
<p> $ cd patchwork</p> | ||
<p> Now you've got a copy of the repository on your computer and it is | ||
automatically connected to the remote repository (your forked copy) | ||
on your GitHub account.</p> | ||
<p> {bold}{cyan} | ||
Connect to the Original Repository{/bold} | ||
----------------------------------{/cyan}</p> | ||
<p> But what if the original repository you forked changes? You'll want | ||
to be able to {bold}pull{/bold} in those changes too. So let's add a remote | ||
connection to the original, {bold}github.com/jlord/patchwork{/bold}, repository | ||
with its URL, found on the right hand side of the original on GitHub.</p> | ||
<p> You can name this remote connection anything you want, but often | ||
people use 'upstream', let's use that for this.</p> | ||
<p> $ git remote add upstream <a href="https://github.com/jlord/patchwork.git">https://github.com/jlord/patchwork.git</a></p> | ||
<p> When you've done these steps, run <code>git-it verify</code>.</p> | ||
<p> {cyan}</p> | ||
<h2 id="-git-tips-"> <strong>GIT TIPS</strong></h2> | ||
<p> {bold}Add remote connections{/bold}</p> | ||
<p> $ git remote add <REMOTENAME> <URL></p> | ||
<p> {bold}View remote connections{/bold}</p> | ||
<p> $ git remote -v{/cyan}</p> | ||
<hr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<p> Install Git.</p> | ||
<hr> | ||
<p> {bold}{cyan} | ||
Get Git{/bold} | ||
--------{/cyan}</p> | ||
<p> Git is {bold}open source software{/bold} (free for anyone to use) written | ||
by Linus Torvalds who also wrote the Linux operating system. </p> | ||
<p> It is a program for keeping track of changes over time, known in | ||
programming as {bold}version control{/bold}.</p> | ||
<p> {cyan}To install Git{/cyan}</p> | ||
<ul> | ||
<li><p>Windows: It's recommended to download GitHub for Windows, | ||
which includes Git and has an easier install: | ||
{bold}windows.github.com{/bold}.</p> | ||
</li> | ||
<li><p>Mac: You can also download GitHub for Mac, which includes | ||
Git, {bold}mac.github.com{/bold} (from Preferences, select | ||
the command line tools install), or Git by itself: | ||
{bold}<a href="http://git-scm.com/downloads{/bold}">http://git-scm.com/downloads{/bold}</a>.</p> | ||
</li> | ||
<li><p>Follow the installation instructions.</p> | ||
<p>Git isn't like other programs on your computer. You'll likely not | ||
see an icon on your desktop, but it will always be available to you | ||
and you'll be able to access it at anytime from your | ||
terminal (which you're in right now!) or Git desktop applications.</p> | ||
<p>Once it is installed, open terminal (aka Bash, aka Shell, aka Prompt). | ||
You can verify that it's really there by typing:</p> | ||
<p>$ git --version </p> | ||
<p>This will return the version of Git that you're running.</p> | ||
<p>Next, configure Git so it knows who to associate your changes to:</p> | ||
<p>Set your name:</p> | ||
<p>$ git config --global user.name "Your Name"</p> | ||
<p>Now set your email:</p> | ||
<p>$ git config --global user.email youremail@example.com</p> | ||
<p>When you're done type into terminal:</p> | ||
<p>$ git-it verify </p> | ||
<p>PRO TIP: Dollar signs are often used in programming documentation | ||
to signify that the line is command line code. You don't actually | ||
type it in, though, only type <code>git-it verify</code>.</p> | ||
<p>When you finish each challenge, type <code>git-it</code> to see the menu and | ||
go to the next challenge. Some of the challenges are longer than the | ||
screen, so don't forget to scroll up to where it begins after it | ||
loads!</p> | ||
</li> | ||
</ul> | ||
<hr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<p> Configure Git and GitHub.</p> | ||
<hr> | ||
<p> The repository you've created so far is just on your computer, which | ||
is handy, but makes it pretty hard to share and work with others on. | ||
No worries, that's what GitHub.com is for! In this challenge, | ||
get Git and GitHub configured.</p> | ||
<p> {bold}{cyan} | ||
Create a GitHub Account{/bold} | ||
-----------------------{/cyan}</p> | ||
<p> GitHub is a website that allows people everywhere to share what | ||
they're working on with Git and to easily work together.</p> | ||
<ul> | ||
<li>Visit {bold}<a href="http://www.github.com{/bold}">http://www.github.com{/bold}</a> and sign up for a free account.</li> | ||
<li><p>High five, welcome!</p> | ||
<p>{bold}{cyan} | ||
Configure Git{/bold} | ||
-------------{/cyan}</p> | ||
<p>You can also add your GitHub username to your Git configuration, | ||
which will be needed in order to verify the upcoming challenges:</p> | ||
<p>Add your GitHub username to your configuration:</p> | ||
<p>$ git config --global user.username githubusername</p> | ||
<p>When you've set everything up, run <code>git-it verify</code></p> | ||
</li> | ||
</ul> | ||
<hr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<p> Add a collaborator.</p> | ||
<hr> | ||
<p> Working with others is one of the best things about GitHub because | ||
it makes it easy to work from all over the world at any time.</p> | ||
<p> {cyan}Collaborators{/cyan}</p> | ||
<p> {bold}Collaborators{/bold} are other GitHub users who are given permission to | ||
make edits to a repository owned by someone else. To add | ||
{bold}collaborators{/bold} to a project, visit the repository's GitHub page | ||
and click the 'Settings' icon on the right side menu. Then select the | ||
'Collaborators' tab. Type in the username to add and click 'Add'.</p> | ||
<p> {bold}{cyan} | ||
Hello, Repo Robot!{/bold} | ||
------------------{/cyan}</p> | ||
<p> Go to the your forked Patchwork repository's page on GitHub and | ||
add 'reporobot' as a collaborator.</p> | ||
<p> {bold}<a href="http://www.github.com/yourusername/patchwork/settings/collaboration{/bold}">http://www.github.com/yourusername/patchwork/settings/collaboration{/bold}</a></p> | ||
<p> When you've added Reporobot as a collaborator to your Patchwork fork, | ||
run <code>git-it verify</code>. </p> | ||
<p> {cyan}</p> | ||
<h2 id="-git-tips-"> <strong>GIT TIPS</strong></h2> | ||
<p> {bold}Pull in changes from a remote{/bold}</p> | ||
<p> $ git pull <REMOTENAME> <BRANCH></p> | ||
<p> {bold}Copy a repository to your computer{/bold}</p> | ||
<p> $ git clone <URL></p> | ||
<p> {bold}Add remote connections{/bold}</p> | ||
<p> $ git remote add <REMOTENAME> <URL></p> | ||
<p> {bold}View remote connections{/bold}</p> | ||
<p> $ git remote -v{/cyan}</p> | ||
<hr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<p> Merge branch, tidy up and pull upstream for much win!</p> | ||
<hr> | ||
<p> Your pull request is being merged! But meanwhile, since you | ||
know that you definitely want those updates in your forked version, | ||
and your branch is in good working order, merge it into the main | ||
branch on your forked repository, in this case, <code>gh-pages</code>.</p> | ||
<p> {bold}{cyan} | ||
Merge a branch{/bold} | ||
--------------{/cyan}</p> | ||
<p> First, move into the branch you want to merge <em>into</em> (in this case, | ||
branch <code>gh-pages</code>).</p> | ||
<p> $ git checkout <BRANCHNAME></p> | ||
<p> Now tell Git what branch you want to merge in (in this case, | ||
your feature branch that begins with "add-").</p> | ||
<p> $ git merge <BRANCHNAME></p> | ||
<p> Tidy up by deleting your feature branch now that it has been merged.</p> | ||
<p> $ git branch -D <BRANCHNAME></p> | ||
<p> You can also delete the branch from your fork on GitHub:</p> | ||
<p> $ git push <REMOTENAME> --delete <BRANCHNAME></p> | ||
<p> {bold}{cyan} | ||
Congratulations!{/bold} | ||
----------------{/cyan}</p> | ||
<p> You've created local repositories, remote repositories, worked with | ||
a collaborator, pushed, pulled and joined the millions of others | ||
developing and enriching open source!</p> | ||
<p> Visit {bold}jlord.github.io/patchwork{/bold} to see your changes incorporated!</p> | ||
<p> And last but not least, if you pull in updates from the original | ||
(since it now shows you on the home page) you'll be up to date | ||
and have a version too, live at: yourusername.github.io/patchwork. </p> | ||
<p> $ git pull upstream gh-pages</p> | ||
<p> When you've merged your branch, deleted it and pulled from the | ||
original, run <code>git-it verify</code>.</p> | ||
<p> {cyan}</p> | ||
<h2 id="-git-tips-"> <strong>GIT TIPS</strong></h2> | ||
<p> {bold}Merge a branch into current branch{/bold}</p> | ||
<p> $ git merge <BRANCHNAME></p> | ||
<p> {bold}Change the branch you're working on{/bold}</p> | ||
<p> $ git checkout <BRANCHNAME></p> | ||
<p> {bold}Delete a local branch{/bold}</p> | ||
<p> $ git branch -D <BRANCHNAME></p> | ||
<p> {bold}Delete a remote branch{/bold}</p> | ||
<p> $ git push <REMOTENAME> --delete <BRANCHNAME></p> | ||
<p> {bold}Pull from a remote branch{/bold}</p> | ||
<p> $ git pull <REMOTENAME> <BRANCHNAME>{/cyan}</p> | ||
<hr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<p> Keep your file up to date, pull in changes from collaborators.</p> | ||
<hr> | ||
<p> If you're working on something with someone you need to stay up | ||
to date with the latest version. So you'll want to {bold}pull{/bold} in any | ||
changes that may have been made.</p> | ||
<p> {bold}{cyan} | ||
Pull in Changes{/bold} | ||
-----------------{/cyan}</p> | ||
<p> See if Reporobot has made any changes to your 'add-' branch by pulling | ||
in from the remote named 'origin' on GitHub:</p> | ||
<p> $ git pull <REMOTENAME> <BRANCHNAME></p> | ||
<p> If nothing's changed, it will tell you 'Already up-to-date'. | ||
If there are changes, it will merge those changes into your local | ||
version.</p> | ||
<p> Did Reporobot make changes? Git tells you where changes were made. | ||
You can open that file and see Reporobot's updates. Surprise, | ||
Reporobot is an artist!</p> | ||
<p> When you've pulled, type <code>git-it verify</code>.</p> | ||
<p> {cyan}</p> | ||
<h2 id="-git-tips-"> <strong>GIT TIPS</strong></h2> | ||
<p> {bold}Check Git status{/bold}</p> | ||
<p> $ git status</p> | ||
<p> {bold}Pull in changes from a remote branch{/bold}</p> | ||
<p> $ git pull <REMOTENAME> <REMOTEBRANCH></p> | ||
<p> {bold}See changes to the remote before you pull in{/bold}</p> | ||
<p> $ git fetch --dry-run{/cyan}</p> | ||
<hr> |
Oops, something went wrong.