Intro to Git

Setting A New Path Upstream

Our new home upstream

Here you can see the rare Alaskan salmon-turtle migrating her repos to a new home upstream

 

Let’s review our progress so far

We’ve made our new recipe, we’ve learned how to make a pull request to a repo that isn’t ours, and how to push our progress to a repo that IS ours.. We’ve learned how to check when something’s been saved correctly and when we have unsaved changes, but we haven’t covered how to connect the repo on our computer with our existing work to the repo we created on the website which is still blank. If our computer catches on fire right now, humanity will never know the joy of Purtle’s Magic Pineapple Mushroom Pizza, and that just can’t happen, so let’s get cracking!

 

You will need

For this you’ll need the url to your new git repository, probably a github link to your personal page like https://github.com/rocksteadytc/dessert-pizzas and you’ll need the dessert-pizzas repo with the commit’d but un-pushed work that we’ve just created in the last class.

 

Note: If you’re using Github, when you created the new blank repo, it already told you how to do this, if you were clever and read what they were telling you. If you missed that, no worries, we’re about to work through it now. 

 

Prepare yourself, this will be really hard

Just kidding, this part will usually only fail if you’re not in a git repo when typing the command, or if you misspell the URL, both are minor errors with easy fixes.

 

git remote add origin https://github.com/RocksteadyTC/dessert-pizzas.git

This will store the remote location of your repository so that at the end of the day you can send your commits to Github where they can have lots of room to run and play with the other commits.

 

git push -u origin master

This is the command that, now that we know where we’re pushing to, will initiate the pushing process. Pushing takes your commits, does some fancy magic which reduces it to only the changes you made, and sends it off to Github or whatever your remote location is. At this point you can toss your computer in the pizza oven and restore your work on a new one just the way it was when you pushed it. Remember, if you haven’t pushed a commit, it may as well have never happened.

 

Extra Credit

So now that we’ve linked ourselves to our own pizza repository and uploaded our dessert pizza recipe, we should add some more recipes to put this thing into high gear! Add a few of your favorite pizzas, and maybe separate them in folders for normal-pizza and dessert-pizza if you’re really fancy.

 

Remember, add, commit, then push, and don’t forget to use very descriptive commit messages to make tracking your recipe changes easier.

Leave a Reply

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

GiottoPress by Enrique Chavez