Learning the basics of Git is extremely helpful, but that alone won’t protect you from disaster because all your work is still confined to your machine.
That’s where GitHub comes in.
With the ability to push your work to a central repository, you vastly expand your world of opportunities and position yourself to be able to work with anyone who understands how to utilize Git and Github.
Before you begin unlocking all the potential of GitHub, you first need to understand how to use it and thankfully it is pretty simple.
You push work from your machine to GitHub. This basically makes a copy of everything in a given directory and places it into a repository on GitHub. These can be public or private and you can control the permissions of each repository, so you can have a mix of project types.
As you make changes, you commit and push your new work to the repository. If you begin working with others, they can push updates to your repository as well. You can control whether they have the ability to immediately update your work OR if it has to wait for your approval.
Finally, if your project isn’t too complex (and your first ones won’t be), you can turn your work into a website that is hosted by GitHub. While you’re somewhat limited by how far you can take this, it’s quite common to host your personal portfolio just using GitHub — for free.
The requirements: Git installed on your machine A GitHub account A repository to point your work to Knowledge of how to push your work to GitHub
In this episode we’re going to be splitting our time between a web browser and the command line, so arrange your windows accordingly so you can easily follow along.
You already have Git installed, so let’s take a moment to create an account at GitHub.com.
While I have had an account for a while, I’m going to create a new account so that I can follow along with the process you’ll be faced with.
(( steps to create account here )) (( newprag, firstname.lastname@example.org, Chicago2019 ))
Let’s go back to our machine and quickly spin up a new project. I’ll make this one for a new client with a pet supply business.
(( create preppy-puppy project folder with index.html file ))
Now that we have a new account and a new project, let’s create a repository where we’ll point the project we’ve created on our machine.
(( create project, name project ))
GitHub does an excellent job providing you with all the information you’ll need to connect everything together, but you want to carefully read the options provided because you might not need some of this information, depending on the status of your work.
(( walk through the options presented ))
There are a few basic commands needed to push your work to GitHub that are just beyond the common commands that we use to set up a new project.
To date, you should already be familiar with: git init, git status, git add, git commit.
To that list we’re now going to add git remote, git push, git pull to that list of commands.
You’ll likely only use git remote as you are getting started but mastering push and pull will be vital for you to successfully use GitHub.
(( connect project )) (( perform minor change on GitHub to mimic what it is like to work with someone else on a project )) (( create minor change on project on computer )) (( commit and try to push )) (( show the error )) (( resolve the error, conflict / pull / push ))
And that’s it. We’ve successfully created a new github account, pushed work from our local machine and solved for a merge conflict error. From here, it’s about getting practice building and shipping test projects to ensure you develop the muscle memory needed to make your usage of Git and GitHub as painless as possible.
I’m Chris Courtney for New Pragmatic, thanks for watching.
Practice: Clone (is this the right term?) a copy of the project 'New Pragmatists’ Append your name to the ReadMe.md file Push your work up Create a pull request so that your name is added to the list
Future assignment… create branch, pull request, merging, forking