If we are not familiar with Github, then we are in luck. This article will give us an overview on what exactly Github is and what's its purpose. Just about every modern developer is required to be able to use some type of Version Control System. So lets go ahead and dive right into it.
What is Github?
Well in technical terms it means the following:
Open Source Distributed Version Control System
Let's break it down to more simpler terms.
Open Source: Free to use software where the source code is visible to the public and allows anyone to use it, study, update, and even distribute.
Control System: Manages, distributes, and stores content. Such as code, writing, pictures, and more types of files.
Version Control System: Software changes rapidly, so Github is a platform that allows us developers to make changes so often and make code better. So we have a nice history of all changes made in the code.
Distributed Version Control System: Github has a remote version stored on the server and stored locally on the developer's computer. Meaning the code is available on a central server, available to all developers to work with.
Before there was any type of Github platform for developers to collaborate on projects, it was much more difficult to share source code to the public, and have a full history of the entire changes. Most of these before Github existed were all either exclusive from the company to share with their own employees or working on some local source code server.
Github solved this issue with allowing anyone to publish code that they wanted to share with other developers. It became such a big thing that Microsoft ended up acquiring Github for nearly $7.5 billion u.s. dollars. I think that should just tell you how important this type of software is to the modern application world.
Making it the largest host of source code in the world.
So how exactly do we keep track of changes in our code? With a Repository!
When we look at the word Repository for the first time, it might be a little overwhelming. But once we understand the definition of it and it's purpose, we will see why repository's are a big thing.
A place, building, or receptacle where things are or may be stored.
.git/ folder would act as our Repository in our project. This folder should always be at our root of our projects folder.
The way we keep track of our changes in our code is with a few
git commands that we can either type in our
.git/ folder doesn't simply track our files automatically. We would need to tell our
repository to accept the changes we have made with a few simple commands. There are a lot of commands to use for specific reasons but we're only going to mention the ones that are the most commonly used to help us track our work progress.
git status: When ever we want to see our changes within our directory, we can run this command in our terminal, giving us a list of files that have been changed, and being tracked.
git commit: We can use this command to save our tracked files to our local repository. We can also leave a message / description about the changes we have made. Importantly this is what allows us to save different states of our code from different stages.
git clone: This command will allow us to clone any
repositorythat is available to use from the Github platform. Some may be private and require access to them.
git branch: An essential command that allows us to create different path's if we ever need to work on different components. Allowing us to test, debug, and more than working on our main file. Think of it as having a
git merge: Merging our paths or branches together is another essential command, allowing us to work on different task on different branches. Once we believe we want a branch merged with another, we can use this command to achieve that.
git push: We can also upload our local repository that we have been working on our machine to the remote repository on the Github platform for others to see or use.
git pull: Updating our local repository is very common when working on a team project. This command will allow us to update our local repository to the latest remote version.
Here is a brief example on how we would use these git commands to track our work.
- Clone: You will clone the repo to have a copy to work with on your personal computer.
- Branch: Checkout a branch and name it using the firstName-lastName format.
- Complete Assignment: Do all the work on your assignment on your personal computer. Commit your work regularly.
- Push: Push your local changes to your remote repo branch.
- Create a Pull Request: This pull request will be made with your student branch against the fork you created in the beginning. Submit this link to Canvas.
These articles are mostly intended for personal use on becoming a better programmer, writer, and grow my programming skills. Feel free to drop any feedback or corrections that you believe that should be made to help me and others. Thank you for your time for sticking this far!