In web development projects there are a lot of important thing to keep track on. For example requirements, budget, time, code quality and testing. However there is one important thing most people easily forget: version control.
Most of the time when starting a new project usage of VCS (Version Control Systems) feels a little bit overkill. However in a few weeks a project gets bigger and bigger. The first version of is released, bugs gets discovered and a second version is released to patch them. The client is also asking for new features and keeping track of new code gets harder and harder.
In this post I will give a few tips how to use GitHub for websites and why it is a must have for all projects.
If you’re not familiar with Git and GitHub at all I recommend you to take a look on this website to learn more about Git
Get familiar with the ‘git flow’
GitHub is based on the Version Control System Git. One of the most important features of Git is the usage of branches. Git flow is a way to use branches to manage new features, releases and bug fixes. Read more about the Git flow in the following links:
If you are using Git from command line I can also recommend this tool:
Knowledge about Git flow is already enough to use GitHub way more efficient than you properly did before. You can for example separate the development of new features, merge specific features to the master branch and fix bugs in the current version.
Use a good .gitignore
In web development projects there is a lot of generated content or packages from 3th parties. For example folder like
build. You don’t want these folders in GitHub. They can make the repository as twice as big and might be platform depend. A few other examples of folders you might want to ignore are:
- IDE folder (like
- tmp (folders for temporary files)
.gitignore is file in the root of your repository. With help of this file you can tell Git which files must be ignored from version control. You can write this file by yourself, but you can also generate it. A useful website is https://gitignore.io. On this website you can select common used frameworks. The tool then generates a
.gitignore that ignores the selected tools.
Use GitHub issues for bugs and features
Each repository on GitHub has een tab named “Issues”. Users can open a issue and starting a start a conversation with each other. Except for reporting bugs, issues are also useful for managing new features. An issue can contain the requirements for the features, assigned users and even the commits.
You can refer from a commit to an issue by adding a issue id using a hashtag (#). You can find the issues id next to the title. For example
git commit -m "#3 Add social icons"
The result of this reference is that this commit is visible in the issue conversation timeline.
It also might also be useful to give your customers access to the GitHub repository. They can post bugs, give answers to questions and get more involved in the development process. The bugs are also directly on the right place, you don’t have to copy-past them from your email.
Checkout on the live environment
According to the Git Flow, the
master branch contains the current release version of the product. If your hosting supports SSH access and Git is installed you can maintain the live version also with Git. Prepare the new release local on your pc, commit to the
master branch en just run a
git pull on the server. This makes deploying easier, faster and safer.
There is only one downside on this. You cannot keep tracking on databases with Git. So you might want to have two databases. One for your development environment and one for the live version.