Skip to content

Posting Chapter Exercise Solutions

John Hampton edited this page Jun 5, 2016 · 10 revisions

Study group members should aim to post exercise solutions by Saturday of each week.

Exercise solutions can be posted in two ways:

  • Adding files to individual feature branches for each chapter (recommended):

    • For each chapter, create a new feature branch off of master - ideally with your name - example: jjhampton/chapter2-exercises. Also include your name in each file name, so other study group members don't accidentally overwrite your work - example: jjhampton-ch2-ex1-triangle.js. Each chapter already has a directory in the repo where the exercise solutions should be saved in - example "Chapter-2-Exercises".

    • When your chapter-branch has been created on GitHub and all of your exercise solutions for the chapter have been committed/pushed, open a Pull Request (PR) from your chapter-branch into the master branch. While your PR is open, others can also post feedback on your code as PR comments. After your PR is reviewed, it can be merged in / closed. When a PR is opened / closed, an automated Slack message will be posted to the Slack channel.

    • This is the recommended workflow, as it most closely resembles a commonly-used Git workflow on a collaborative web project. Users not experienced in using Git may learn a bit more about using Git if they follow this approach.

  • Adding files directly to the master branch:

    • You may commit/push up your individual exercise files directly to the master branch. Committing directly to master is generally not a best practice on a real project. In our case, there's really no harm done, since we're just adding separate files which don't affect any other files. Anyone should be safe committing directly to master as long as they only add/edit their own files and don't modify anyone else's.

    • One issue w/ committing directly to master is that if multiple people are doing that around the same time, your local version of master may get behind the remote master, and when you try to push up a change to GitHub, Git will tell you: Updates were rejected because the tip of your current branch is behind its remote counterpart. This is because there are newer commits on the remote (GitHub) than you have on your local machine, most likely from commits to master that others have made since you last did a git pull or git fetch. If you see that, you'll have to git pull or git pull --rebase so your local master is up-to-date with the remote changes on GitHub, and then you can try to git push again.

  • Links to external code snippets:

    • Publish your code with any code-snippet sharing service - popular ones are Gist, CodePen, JSBin, or Plunker

    • Post your code snippet link in GitHub Issues or the Slack channel so others can review your work.

    • If you're not experienced with Git/GitHub or simply don't want to create new branches/PRs, this option may be easier.

Clone this wiki locally