Intro to Git

Developing Our Recipe

Let’s Store Our Progress

Git lets us place a bookmark in our progress so that we can return later if something went wrong along the way. This snapshot is called a ‘commit’. Let’s add our recipe in Git so that we can save the progress in a commit before we continue. The following commands should be done in the same directory we just cloned, with the rest of the recipes.


The excitement is high. Infinity pizzas are in sight. We're going to win this.
This pineapple git pizza recipe is going to be so good that we’ll win two months of free pizza by the time we’re done.

Add the new recipe with your unique filename like this:

git add best-pineapple-pizza.txt


(In this case, I decided to name mine best-pineapple-pizza.txt)


Git will only track the files and folders it clones and the ones you tell it to watch. You can see what Git thinks is going on in your repository by typing git status after you save your new recipe which will show you what’s been modified since the last commit. A commit is basically just a save-point in your progress so you can easily go back later and see when something changed.


In our recipe, we should have a list that looks something like this:

dough, sauce, cheese, mushrooms, pineapple


Let’s store our changes! Save your recipe and create a commit like this:

git commit -am "adding Purtle's Best Pineapple Pizza"

The message in the commit there is very important so that later when you or your helpers want to see where a certain part changed, you can easily find where the change was made and who changed it.


Don’t Neglect The Pepperoni

That sounds pretty good so far, we’ve got a recipe for a tasty pizza with pineapple, mushrooms, and cheese, but we forgot the pepperoni!


Go ahead and add pepperoni to our list of ingredients in your unique recipe and save the file.


Now that you’ve fixed the recipe, make a commit that has the commit message "adding pepperoni to Purtle's recipe"


Since the new recipe file was already added to the repository earlier, you didn’t have to add it again before the second commit because Git was already watching it. Once a file is added, you don’t have to add it a second time for Git to track the changes.


You can view your history of commits by doing git log which should show two of your commits: "adding Purtle's Best Pineapple Pizza" and "adding pepperoni to Purtle's recipe" with timestamps for those changes.

The recipe is complete, now what?

Let’s retrace our steps a little bit and review: first we cloned a repo, which put a copy of the recipe book on our computer, then we added our recipe and made a few commits to the repo on our computer. What now, though? How do we get the code into the Github repo we saw on the website? In reality this goes several ways, if you cloned a repo you had access to, you can just “push” your code because you already have permission to modify that repo, if you cloned the repo in this example, you probably don’t have permissions to access it, so the part about “pull-requests” will be more relevant to you.


If you have permission to the repo

For example if you forked a repo via the website, and then cloned your own personal copy from your repo, do this:

git push origin master

This should send your changes to the remote repository, in the off chance that someone modified it since the last time you pulled the updates, you can do git pull before you git push to get rid of any nagging errors about not having current commit history present when trying to push.


If you don’t have permission to the repo (this is you, reader)

Let’s say you saw a recipe that had a typo, you’d fork the repo, push the changes, and then request that the owner pulls in your fix. This is called a “Pull Request”, and it’s how you contribute changes to a project owned by someone else. Pull Requests don’t happen in your terminal, they happen on the website that tracks your git repos, but the process is the same:

  • fork a repository
  • clone your fork of the repository
  • commit your changes and improvements to your own fork
  • push to your fork of the repository
  • make pull request between the two repos, your fork and the original repo


When your pull request gets accepted by the owner of the repository, you can delete your copy since the changes will exist in the main repository. But if your pull-request doesn’t get accepted? No way, surely this pizza recipe is a winner….. right? Let’s find out!


Extra Credit

Make a pull request with your recipe to

Leave a Reply

Your email address will not be published. Required fields are marked *

GiottoPress by Enrique Chavez