diff --git a/html/branches_arent_just_for_birds_problem.html b/html/branches_arent_just_for_birds_problem.html new file mode 100644 index 0000000000..9d852d1241 --- /dev/null +++ b/html/branches_arent_just_for_birds_problem.html @@ -0,0 +1,60 @@ +
Create a new branch for your contribution.
+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.
+{cyan}GitHub Pages{/cyan}
+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:
+http://githubusername.github.io/repositoryname
+{bold}{cyan} + Create a branch{/bold} + ---------------{/cyan}
+When you create a branch, Git copies everything from the current + branch you're on and places it in the branch you've requested.
+ Type git status
to see what branch you're currently on (it
+ should be 'gh-pages')
Create a branch and name it "add-
$ git branch
Now you have a branch with a new name identical to 'gh-pages'.
+ To go into that branch and work on it, similar to using cd
to
+ change directory in terminal, you {bold}checkout{/bold} a branch.
$ git checkout
{bold}{cyan} + Create a new file{/bold} + --------------------------{/cyan}
+ Back to the text editor. In the 'contributors' folder, create a
+ new file named "add-
{bold}{cyan} + Check-in{/bold} + --------{/cyan}
+Go through the steps for checking in a project:
+ $ git status
+ $ git add
Now push your update to your fork on GitHub:
+ $ git push origin
Type git-it verify
when you're done.
{cyan}
+You can create and switch to a branch in one line:
+ $ git checkout -b
Create a new branch:
+ $ git branch
Move onto a branch:
+ $ git checkout
List the branches:
+$ git branch
+Rename a branch you're currently on:
+ $ git branch -m
Verify what branch you're working on
+$ git status{/cyan}
+Create a file in your new repository, add something to that file and + commit those changes to Git.
+Now that you've got a repository started, add a file to it.
+{bold}{cyan} + New File{/bold} + --------{/cyan}
+ 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 readme.md
in the folder you created in the last lesson.
{bold}{cyan} + Check, Add and Commit Changes{/bold} + -----------------------------{/cyan}
+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:
+$ git status
+Then {bold}add{/bold} the file you just created to the files you'd + like to {bold}commit{/bold} (aka save) to change.
+$ git add readme.md
+Finally, {bold}commit{/bold} those changes to the repository's history with a + short description of the updates. See the command hints below!
+$ git commit -m "your commit message"
+{bold}{cyan} + Make More Changes{/bold} + -----------------------------{/cyan}
+ Now add another line to readme.md
, perhaps a title, and save.
In terminal, you can view the {bold}diff{/bold}erence between the + file now and how it was at your last commit.
+$ git diff
+Now with what you just learned above, commit this latest change.
+ When all changes are committed, run git-it verify
.
{cyan}
+{bold}Check status of changes to a repository{/bold}
+$ git status
+{bold}View changes to files{/bold}
+$ git diff
+{bold}Add a file's changes to be committed{/bold}
+ $ git add
{bold}To add all files' changes{/bold}
+$ git add .
+{bold}To commit (aka save) the changes you've added with a short + message describing the changes{/bold}
+$ git commit -m "your commit message"{/cyan}
+Fork a project from GitHub.com and clone it locally.
+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.
+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.
+Once a project is forked, you then {bold}clone{/bold} (aka copy) it from + GitHub to your computer to work on locally.
+{bold}{cyan} + Fork{/bold} + ----{/cyan}
+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.
+{bold}{cyan} + Clone a Repository{/bold} + -------------------{/cyan}
+ 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: cd ..
$ git clone
Navigate into that folder (in this case, named 'patchwork')
+$ cd patchwork
+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.
+{bold}{cyan} + Connect to the Original Repository{/bold} + ----------------------------------{/cyan}
+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.
+You can name this remote connection anything you want, but often + people use 'upstream', let's use that for this.
+$ git remote add upstream https://github.com/jlord/patchwork.git
+ When you've done these steps, run git-it verify
.
{cyan}
+{bold}Add remote connections{/bold}
+ $ git remote add
{bold}View remote connections{/bold}
+$ git remote -v{/cyan}
+Install Git.
+{bold}{cyan} + Get Git{/bold} + --------{/cyan}
+Git is {bold}open source software{/bold} (free for anyone to use) written + by Linus Torvalds who also wrote the Linux operating system.
+It is a program for keeping track of changes over time, known in + programming as {bold}version control{/bold}.
+{cyan}To install Git{/cyan}
+Windows: It's recommended to download GitHub for Windows, +which includes Git and has an easier install: +{bold}windows.github.com{/bold}.
+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}http://git-scm.com/downloads{/bold}.
+Follow the installation instructions.
+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.
+Once it is installed, open terminal (aka Bash, aka Shell, aka Prompt). +You can verify that it's really there by typing:
+$ git --version
+This will return the version of Git that you're running.
+Next, configure Git so it knows who to associate your changes to:
+Set your name:
+$ git config --global user.name "Your Name"
+Now set your email:
+$ git config --global user.email youremail@example.com
+When you're done type into terminal:
+$ git-it verify
+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 git-it verify
.
When you finish each challenge, type git-it
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!
Configure Git and GitHub.
+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.
+{bold}{cyan} + Create a GitHub Account{/bold} + -----------------------{/cyan}
+GitHub is a website that allows people everywhere to share what + they're working on with Git and to easily work together.
+High five, welcome!
+{bold}{cyan} +Configure Git{/bold} +-------------{/cyan}
+You can also add your GitHub username to your Git configuration, +which will be needed in order to verify the upcoming challenges:
+Add your GitHub username to your configuration:
+$ git config --global user.username githubusername
+When you've set everything up, run git-it verify
Add a collaborator.
+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.
+{cyan}Collaborators{/cyan}
+{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'.
+{bold}{cyan} + Hello, Repo Robot!{/bold} + ------------------{/cyan}
+Go to the your forked Patchwork repository's page on GitHub and + add 'reporobot' as a collaborator.
+{bold}http://www.github.com/yourusername/patchwork/settings/collaboration{/bold}
+ When you've added Reporobot as a collaborator to your Patchwork fork,
+ run git-it verify
.
{cyan}
+{bold}Pull in changes from a remote{/bold}
+ $ git pull
{bold}Copy a repository to your computer{/bold}
+ $ git clone
{bold}Add remote connections{/bold}
+ $ git remote add
{bold}View remote connections{/bold}
+$ git remote -v{/cyan}
+Merge branch, tidy up and pull upstream for much win!
+ 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, gh-pages
.
{bold}{cyan} + Merge a branch{/bold} + --------------{/cyan}
+ First, move into the branch you want to merge into (in this case,
+ branch gh-pages
).
$ git checkout
Now tell Git what branch you want to merge in (in this case, + your feature branch that begins with "add-").
+ $ git merge
Tidy up by deleting your feature branch now that it has been merged.
+ $ git branch -D
You can also delete the branch from your fork on GitHub:
+ $ git push
{bold}{cyan} + Congratulations!{/bold} + ----------------{/cyan}
+You've created local repositories, remote repositories, worked with + a collaborator, pushed, pulled and joined the millions of others + developing and enriching open source!
+Visit {bold}jlord.github.io/patchwork{/bold} to see your changes incorporated!
+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.
+$ git pull upstream gh-pages
+ When you've merged your branch, deleted it and pulled from the
+ original, run git-it verify
.
{cyan}
+{bold}Merge a branch into current branch{/bold}
+ $ git merge
{bold}Change the branch you're working on{/bold}
+ $ git checkout
{bold}Delete a local branch{/bold}
+ $ git branch -D
{bold}Delete a remote branch{/bold}
+ $ git push
{bold}Pull from a remote branch{/bold}
+ $ git pull
Keep your file up to date, pull in changes from collaborators.
+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.
+{bold}{cyan} + Pull in Changes{/bold} + -----------------{/cyan}
+See if Reporobot has made any changes to your 'add-' branch by pulling + in from the remote named 'origin' on GitHub:
+ $ git pull
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.
+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!
+ When you've pulled, type git-it verify
.
{cyan}
+{bold}Check Git status{/bold}
+$ git status
+{bold}Pull in changes from a remote branch{/bold}
+ $ git pull
{bold}See changes to the remote before you pull in{/bold}
+$ git fetch --dry-run{/cyan}
+Connect your local and remote repositories and push changes.
+GitHub.com stores a {bold}remote{/bold} copy of your repository (it's + 'remote' because that copy is not on your computer, but on a server + elsewhere). By {bold}pushing{/bold} your {bold}local{/bold} (on your computer) + changes to it, you keep it up to date. That way others can always get the + latest, too. And everyone can work on a project together without needing + access to your computer where your local copy is stored.
+{bold}{cyan} + Create a Remote Repository{/bold} + --------------------------{/cyan}
+You want to sync your {bold}local{/bold} version with one stored on GitHub.com + called the {bold}remote{/bold} version. So first create an empty + remote repository on GitHub.com.
+readme.md
.Click create repository!
+{cyan} +Readmes, .gitignores and Licenses{/cyan}
+These are common files in open source projects.
+A {bold}readme{/bold} explains what the project is, how to use it, and often +times, how to contribute (though sometimes there is an extra file, +CONTRIBUTING.md, for those details).
+A {bold}license{/bold} file is the type of license you put on your project, +information on the types is here: +{bold}www.choosealicense.com{/bold}.
+We don't need any of them, however, for this example.
+{bold}{cyan} +Connect your Local to your Remote{/bold} +---------------------------------{/cyan}
+Now you've got an empty repository started on GitHub.com. At the +top you'll see 'Quick Setup', make sure the 'HTTP' button is +selected and copy the address - this is the location of your +repository on GitHub.
+Back in your terminal, and inside of the folder that you
+initialized as a Git repository in the previous challenge, you
+want to tell Git the location of the remote version. This is
+commonly named origin
.
$ git remote add origin
A note:
+If you have GitHub for Windows on your computer, a remote + named 'origin' is automatically created. In that case, you'll + just need to tell it what URL to associate with origin. Use this + command instead of the 'add' one above:
+Your {bold}local{/bold} version is now connected to the + {bold}remote{/bold} on GitHub.com.
+{bold}{cyan} + Push Work to your Remote{/bold} + ---------------------------------{/cyan}
+Next you want to {bold}push{/bold} everything you've done locally + to GitHub.
+Git has a branching system so that you can work on different + parts of a project at different times. By default the first + branch is named master. When you push (and later pull) from + a project, you tell Git the branch name you want and the + name of the remote that it lives on.
+$ git push origin master
+For a visual on how branches work in a project, see this + GitHub Guide: {bold}guides.github.com/overviews/flow/{/bold}
+Now go to GitHub and refresh the page of your repository. WOAH! + Everything is the same locally and remotely. Congrats on your + first public repository!
+When you're synced locally and on GitHub.com, run:
+$ git-it verify
+{cyan}
+{bold}Add remote connections{/bold}
+ $ git remote add
{bold}Set a URL to a remote{/bold}
+ $ git remote set-url
{bold}Pull in changes{/bold}
+ $ git pull
{bold}View remote connections{/bold}
+$ git remote -v
+{bold}Push changes{/bold}
+ $ git push
Create a new Git repository.
+A {bold}repository{/bold} is essentially a project. You can imagine it + as a project's folder with all the related files inside of it. In + fact, that's what it will look like on your computer anyways.
+You tell Git what your project is and Git will start tracking all + of the changes to that folder. Files added or subtracted or even + a single letter in a single file added -- all of it's tracked and + time stamped by Git.
+{bold}{cyan} + Create a Repository{/bold} + -------------------{/cyan}
+You're going to create a new folder and initialize it as a Git + repository. You'll need some basic terminal (Bash) commands (see + below) for moving around and creating folders (just like you'd do + in Finder or Windows Explorer).
+To make things easier, name your folder what you'd name the project, + keep it lowercase, no spaces or symbols. How about 'sandwich'.
+You can type all of this here in your terminal window.
+To make a new folder:
+$ mkdir sandwich
+To go into that folder:
+$ cd sandwich
+To create a new Git instance for a project:
+$ git init
+That's it! It will just return you to a new line.
+When you've initialized a new Git repository, run:
+$ git-it verify
+{cyan}
+{bold}Make a new folder (aka directory){/bold}
+ $ mkdir
{bold}Navigate into an existing folder (aka change directory){/bold}
+ $ cd
{bold}List the items in a folder{/bold}
+$ ls
+{bold}Turn Git on for a folder{/bold}
+$ git init{/cyan}
+Submit a Pull Request.
+When you make changes and improvements to a project you've forked, + often you'll want to (and have intended to from the get-go) send + those changes to the maintainer of the original and {bold}request{/bold} that + they {bold}pull{/bold} the changes into the original so that everyone can + benefit from the updates - that's a {bold}pull request{/bold}.
+We want to add you to the list of workshop finishers, so make + a {bold}pull request{/bold} to the original: {bold}www.github.com/jlord/patchwork{/bold}.
+{cyan}{bold} + Create a pull request + ---------------------{/bold}{/cyan}
+visit the original repository you forked on GitHub, in this case +{bold}http://www.github.com/jlord/patchwork{/bold}
+Often GitHub will detect if you've pushed a branch to a fork and +display it at the top of the original's website. If you see that, +you can click Create Pull Request. If not:
+Click 'Pull request' on the right-side menu, then 'New pull request'.
+Select the branch with the changes you want to submit (it should be +the one with 'add-' and your username).
+You'll now see a page with the details of the pull request you're +in the process of submitting. The page shows the commits and changes +associated with your pull request. If the original repository has a +contribution documentation, GitHub will link to it.
+If everything good, and as you expect it:
+click 'Create pull request'
+click 'Send pull request'!
+High five! When you've submitted your pull request, take a few +seconds to bask in the moment. Then see if your pull request is +merged right before your eyes! If it is, you're golden, run:
+$ git-it verify
+If it's not merged automatically within a few moments, you'll then +likely have some comments from Reporobot on why it couldn't merge +it. If so, close your pull request on GitHub.com, make the necessary +changes to your branch, push those changes and resubmit your pull +request.
+Install Git. + + -------------------------------------------------------------------- + {bold}{cyan} + Get Git{/bold} + --------{/cyan} + + Git is {bold}open source software{/bold} (free for anyone to use) written + by Linus Torvalds who also wrote the Linux operating system. + + It is a program for keeping track of changes over time, known in + programming as {bold}version control{/bold}. + + {cyan}To install Git{/cyan} + + - Windows: It's recommended to download GitHub for Windows, + which includes Git and has an easier install: + {bold}windows.github.com{/bold}. + + - 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}http://git-scm.com/downloads{/bold}. + + - Follow the installation instructions. + + 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. + + Once it is installed, open terminal (aka Bash, aka Shell, aka Prompt). + You can verify that it's really there by typing: + + $ git --version + + This will return the version of Git that you're running. + + Next, configure Git so it knows who to associate your changes to: + + Set your name: + + $ git config --global user.name "Your Name" + + Now set your email: + + $ git config --global user.email youremail@example.com + + When you're done type into terminal: + + $ git-it verify + + 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 `git-it verify`. + + When you finish each challenge, type `git-it` 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! + +
+ + + + + + + diff --git a/txtToHTML.js b/txtToHTML.js new file mode 100644 index 0000000000..3bf9e01638 --- /dev/null +++ b/txtToHTML.js @@ -0,0 +1,28 @@ +var fs = require('fs') +var marked = require('marked') +var glob = require('glob') + +glob("**/*.txt", function (err, files) { + if (err) return console.log("Err globbing") + var matches = [] + files.forEach(function(file) { + if (file.match('problems/')) { + matches.push(file) + } else return + }) + convertToHTML(matches) +}) + +function convertToHTML(files) { + files.forEach(function(file) { + var filename = createFilename(file) + var txt = fs.readFileSync(file) + var html = marked(txt.toString()) + fs.writeFileSync('html/' + filename + '.html', html) + }) +} + +function createFilename(origname) { + var string = origname.split('/').splice(1, 2).join("_") + return string.toString().replace('.txt', '') +}