GitHub is a website and cloud-based service that helps users to store and manage their code, as well as track and control changes. To understand exactly what GitHub is, you need to know two connected principles, version control and Git.
In this article we'll first explain these two core principles. Then, we'll dig into more about GitHub and how you can use my favourite tips and tricks that I use in my daily workflow that you may not be familiar with.
Version control helps users track and manage changes to a software project's code. As a software project grows, version control becomes essential, for example with WordPress.
WordPress is a pretty big project. If a core developer wanted to work on one specific part of the WordPress codebase, it wouldn't be safe nor efficient to have them edit the source code. Instead, this is where version control comes in where developers can safely work through branching and merging projects. With branching, a developer can duplicate the part of the source code which is called the repository. The user can then safely make changes to that part of the code without affecting the rest of the project. Once, the user gets his or her part of the code working, he or she can merge that code back into the main source code branch to make it official. Then, all of the changes can be tracked and reverted if need be.
Git is a specific open source version control system created by Linus Torvalds, the creator of the Linux kernel, in 2005. Specifically, Git is a distributed version control system, which means that the entire codebase and history is available on every developer's computer, which allows for easy branching and merging.
GitHub is for profit company that offers a cloud based Git repository hosting service. Essentially it makes it a lot easier for individuals and teams to use Git for version control and collaboration of software projects. The GitHub interface is user friendly, and novice coders can take advantage of Git. Without GitHub, using Git itself generally requires a more technical savvy and use of the command line. GitHub can also be used in different forms due to its very user friendly interface portal, and some people use GitHub to manage other types of projects such as writing books and notes.
Additionally, anyone can sign up and host a public code repository free of charge, which makes GitHub enticing to many users in the community across the globe, especially when it comes to popular open source projects.
As an organisation, GitHub makes money selling hosted private code repositories, as well as other business focused plans that makes it easier for businesses to manage software team members and security.
Go to GitHub and sign up for account on your web browser on your computer, phone, or tablet by entering your details such as your username, email address and password. To go the next step to verify the account and choosing the plan of Free to get started with GitHub.
GitHub Guide and Hello World
The Hello World project is a classic tradition in computer programming. It's a simple exercise that gets you started when learning something new in programming and testing software for the very first time. GitHub guide gives you important documentation on GitHub functions for users that are getting started with GitHub interface.
Exploring GitHub interface
To give you a basic understanding of what the GitHub interface looks like, here is an example of WordPress source code hosted at a GitHub repository.
From here you can view the various branches that are being worked on, as well as when someone made a commit, this is kind of like saving a file on a computer. Depends on how a repository is setup, you might be able to create your own branch and make your own commits there.
Another trick on GitHub is Line Highlighting which allows you to click on a line number, but you can also link to a range of lines too. Also, you can select a range of lines from a file by first clicking a line number from the GitHub UI, holding down "shift" and clicking the ending line which is beneficial to users analysis code issues that is needed to be fixed or noted for referencing.
If you're getting into open source and using GitHub in general, you can learn about all the keyboard shortcuts that is available on a given page by hitting "Shift+?".
Make sure that you click "show all" for additional shortcuts, including another keyboard shortcut trick is the 't' key to find file names quickly.
You can create task lists in pull requests with markdown demonstrated below, which will render as the following in your pull request.
You can check the boxes too once you save the description of the pull request. Also, you can edit the description to add more to-dos, manage complete vs incomplete in a project. Plus, they show up as to-do's on the master list of project repositories which is a mind blowing feature for those unfamiliar with GitHub functions.
Commits by Author
You can find the contributions made by an author with the '?author=<github_username>' query string param. I find this, handy when I want to see my past contributions on a large project or single out a specific developer's commits on a project.
There is benefits to starting out as those who are new to GitHub and want to explore what it can do for you. You may or may not be familiar with some of the GitHub tricks or even all of them. Learn more about GitHub here and I'd love to hear from you about your favorite GitHub tips that save you time and improve your code workflow.