Skip to main content

Section 6.6 Working Together: The Culminating Experience

As in Section 4.6, this part is a large activity designed to help you practice the skills and ideas learned in the previous sections. It also represents an example of what a typical workflow might look like. You are welcome and encouraged to refer back to the summary and the sections themselves.
As before, the activity below is broken up into multiple parts. In order to help you remember the procedures, I will not be adding in cross references to the corresponding chapters. That being said, I will add in hints and answers where applicable. Do note that some of the steps have no “correct” answer. This will be noted in the corresponding answer.
This activity will involve you contributing to the repository for this book. This will help me get an estimate of how many people are reading the book (since I can see the number of forks). You will be typing a short paragraph of your desired superpower.

(b)

Fork the repository.
Answer.
Click on the “Fork” button in the top right. (You can keep the same name.)

(c)

Make sure your branch is up to date with ian-curtis/gitstarted:main.

(d)

Clone your fork on to your computer. Navigate to the repo using your terminal.
Answer.
Copy the HTTPS link to your fork on GitHub. Use git clone <copied-link>. Use cd <repo-name> to move your terminal into that repo.

(e)

Create a new, appropriately-named branch. Switch to that branch.
Answer.
This could vary. Perhaps superpower, power, or add-superpower?

(f)

There is a file called superpower.md inside of the book-activities folder. Use your terminal to open that file (if using VS Code, use the terminal; if not, try to use your terminal).
Answer.
cd book-activities first, then code superpower.md to open just the markdown file (not the entire repository) (if using VS Code); if using a different editor, use Google to find a good terminal command (or do it manually)
OR cd .. to go backwards a folder, then code gitstarted to open the entire repository, then open the markdown file using work (to use Git functions again, you may have to cd gitstarted again)

(g)

Edit the markdown file with your contribution. Instructions are in the file and are pasted below:
Here is the file for the culminating experience of Chapter 6 from Git Started. Below, type your GitHub username as a level two heading and then type a short paragraph of the superpower you wish you had and why. This could be anything!! See my example.
Make sure to save the file when you are done.

(h)

Make sure Git is tracking your file.
Answer.
git status

(i)

Stage your file.
Answer.
  • git add . or
  • git add book-activities/ or
  • git add book-activities/superpower.md

(j)

Check to make sure your file got staged correctly.
Answer.
git status

(k)

Commit your file with a good commit message.
Answer.
git commit -m '<your-message>'

(l)

Push your changes back to your fork on GitHub
Answer.
git push origin superpower

(m)

Go back to GitHub and merge your changes into your fork’s main branch, then into the upstream main branch.
OR Go back to GitHub and open a pull request to merge your changes directly into the upstream branch.
Answer.
Create a pull reqeust from superpower to your fork’s main then from your fork’s main to upstream main.
OR Create a pull request from superpower directly to the upstream main.

(n)

Wait for me to accept your pull request and merge your changes into the main branch.

(o)

In the meantime, switch back to main and set an upstream remote for your clone.
Answer.
git switch main, then
git remote add upstream https://github.com/ian-curtis/gitstarted.git
It is important to switch back to main or you will set an upstream remote for just your branch which is sometimes useful, but not here.

(p)

Once I have accepted your changes, make sure your fork and your clone both have those changes.
Answer.
(on main branch) git pull upstream main, git push origin main

(q)

For extra credit, create a new branch and do some typo correction on this book. If you do more than one chapter/section, try to do multiple commits. Submit a pull request explaining your changes and I might merge it!
Or, learn PreTeXt, the markup language this book is written in 54  and suggest some edits or new content.

(r)

For as long as you wish to stay up-to-date on the code for this book, pull from upstream often.
And that’s that! Hopefully you’re getting the hang of this process with all of this repetition. If you ever need to practice this again (or need a refresher on what to do), revisit this page. It might take a little bit to become fully comfortable with the process and to remember the order in which to do things. In time, you will get it! Good luck in the rest of your Git/GitHub journey!