When working on large, robust websites, it’s easy to overlook what changes have been made to templates or style sheets. So how do you follow updates and make sure you don’t accidentally undo the work of someone else on your team? There are many ways something could go wrong when enough people are working on the same website. And that’s where Git and GitHub come in handy.
Git is a tool that tracks the revision history of my source code. It knows what changes I’ve made to specific lines of code, and can even tell when I’ve added or removed files from a project. I can also leave comments about different tasks or specific revisions, which makes it a lot easier to figure out why I made certain changes later on. As much as I’d like to think I have a great memory, it’s easy to forget what I’ve done in the past when juggling multiple projects.
GitHub is a service that hosts web projects that are being tracked via Git. The files are published to GitHub where other team members can view the revision history, leave comments, and download the source code to work on their own changes. Team members can create branches of a project if they’d like to take it in a different direction and then merge those changes back to the original project files.
Here are the main reasons I like using Git and GitHub:
- Version control: When you make changes to a website, you may inadvertently break something in the code. But have no fear, that’s where version control comes to the rescue! Git works as a version control system where you can rollback to previous versions of a project. If you make an update that completely breaks something else on a site, you can use Git to load the files from a previous version before the error or issue occurred.
- Documenting changes: Over time a website goes through many updates and edits. With so much going on, details can get lost in the mix. That’s where Git’s tool of adding comments before committing changes is incredibly helpful. After making updates or edits to the source code, you add a comment about the changes, then commit the changes to sync with the project. Later you can see when changes were made and why they were made by reviewing your previous comments.
- Commenting on changes: GitHub makes it easier to communicate with other team members who review your code. You can comment back and forth about specific lines of code, which helps smooth out any bumps in your development logic. After all, having a second pair of eyes review your work is a great way to catch mistakes you may have missed.