Using Git and GitHub can be a little intimidating at first. But worry no more; here are the tips, tricks, and analogies that will help you get started with Git and GitHub.
In this blog, you’ll learn the absolute essentials of Git and GitHub:
These are just the very essentials you need to get started. By the end of this blog you’ll have the tools you need to work on a solo project using Git and GitHub. You’ll also have the skills to get started on this Cloud Skills Challenge: “Get Learning with Git – Git skills and GitHub tools”.
For more concepts after you have these basics, I’ll be creating a new blog soon “Get Collaborative with Git” for how to use Git when working in teams. (For now, you can watch this video)
For extra Git tools, you can also check my blog, “Git yourself a leg up – Git tools for teaching and teams”.
I’ll cover the points in the blog below, but you can also get them in video form here:
You’ve probably heard about Git and GitHub when discussing version control. But why is version control so important?
In short, version control is the idea that we want to keep track of how our code is changing over time and have ways to get back to previous versions of our code. (ideal if a bug appears in your program and you want to figure out where it came from)
There are lots of different implementations of version control. Git is one implementation of version control and is the most popular and widely used option. It has features that allow you to have multiple people collaborating on the same code, ways to integrate conflicting changes different coders make as they work together, and many other handy things.
GitHub is a cloud-based platform that runs on the Git protocol. It is a way of using all the handy features of Git, whilst also backing up your code on the cloud and making it accessible to the rest of your team. There are LOTS of other features GitHub gives you (like options for testing your code, integrating with deployment systems, and more), but you don’t need to know about any of that to get started with.
Repo is short for Repository. This is essentially your project.
This project or repo will have all the files that you and your team create. It will also have the version history of all the changes that have been committed to the project along the way.
You can manage who has access to your repo, review changes your team has made, and set up automations for testing and deployments (once you get past the basics).
It’s easy to create a new repo on GitHub once you have an account. You can just click the “new” button or the “+” button on the home page, and the give your repo a name and add any other details.
To answer questions 3, 4, and 5, an analogy will help us understand.
Git commands get a lot easier when we think about it like a shopping trip.
Let’s say we are shopping for a new outfit. In our example we:
You can also do this from the command line with the following command:
git add <your_file_name>You can include multiple files, but don’t have to add all of your changes at the same time. You might want to put them through in separate transactions (just like at the shops if you want items of different receipts. Eg: For personal expenses versus work expenses)
git commit -m “Write the note for your commit here”
git push
“Add” means to get our changes ready to be added to the log by noting which files (or parts of files) are staged for the upcoming commit.
“Commit” is both the action of committing the changes you have just staged, as well as a “Commit” being an item in the log with the changes that were added.
When you are ready to add your code to the log you “commit it”.
When you want to review changes that happened at one point in the log you may look at a specific commit.
5. Why do we “Push”?
“Push” is when you put the commits that you have made locally on your computer onto the cloud version of your repository.
If you’ve liked learning this, make sure to check out my other Git blogs and videos:
See my video on how to Get Collaborative with Git to learn about working in teams.
And see my blog on how to “Git yourself a Leg up with GitHub Tools” for the newer tools that will make your life easy!
And don’t forget to give the Cloud Skills Challenge a go to put your new GitHub knowledge into action and to learn more.
For students and educators out there you should also take advantage of the GitHub Student Developer Pack!
Get all the free GitHub resources for students and educators, including GitHub Copilot, extra Codespaces quota, and learning resources. Check out this blog if you need help getting signed up.
Thanks for reading! To stay up to date with what I’m doing, you can check out the links on my LinkTree. If you follow through to my personal website you’ll find even more videos by me!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.