How to use Git to improve your web development process
Is your web development team getting bigger? Are your projects getting more complex as well? Do your team members all work on their own versions of source code? Does this cause everyone headaches?
If you are facing the problem of not keeping pace with the story, that is, you run the risk of overwriting someone else’s work, you should employ a version control system which tracks history of your development. Even if you are working alone, your choice should be Git. Git is the most famous VCS in the world and here we will talk about its benefits for the web development process.
What is Git? (A short history)
Git is a distributed revision control system, which helps developers (both web and software) to control versions and track history of their code.
The name comes from its creator, Linus Torvalds (who is also the creator of Linux kernel), who says that he names everything after himself (such as Linux, which comes from his name in combination with Unix). By the way, in British slang, ‘git’ refers to a foolish or worthless person, which is a sort of Torvalds’ self-criticism.
“The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your way):
– random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
– stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
– “global information tracker”: you’re in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
– “goddamn idiotic truckload of shit”: when it breaks.” (Source: Wikipedia)
Git development started in April 2005 when Torvalds realized that he and his team needed a distributed system, like BitKeeper (which was no longer available for use), to manage source-code with the rest of the team in the quickest way possible.
Since he disliked the available VCSs, he started creating his own. 30 seconds was too long a time for him to apply a patch and update metadata, so the first design criterion was that patching should last three seconds max. Besides this, he added some more features, such as branching. which would eventually transform into what we now know as Git.
After achieving his first goal in July 2005, he handed over Git maintenance to Junio Himano, a project contributor. The newest version is 2.15 which was published on October 30, 2017.
The benefits of Git
Git is an easy-to-use software that helps you enhance your development system in numerous ways:
- Productivity improvement
- Code-quality improvement
- Freedom to not worry about versions
- The option of experimentation
- Tracking changes
- Undoing mistakes
- Progress overview
- Working offline on your local server
- Being carefree about data loss
How Git can improve your website development process:
Every project is different from another because each website development process demands a different approach. Some teams may be used to one workflow, whereas others to something completely unseen. However, there are some proven workflows you can implement in your projects:
- Basic workflow — Git developers today like using this workflow for simple websites because right from the start they copy/clone the central repository and work locally on their piece of code, and only then do they apply it to the central repo for other developers to use.
- Feature branch — Git introduced branches to improve the code and this core feature is what makes it so special. Feature branch implies two (or more) people working on different features separately and then joining each branch with the master branch independently from the second (or third or any other) branch, without ruining the code.
- Gitflow — this workflow allows for the development of complex projects with two parallel branches: (1) master branch, which was tested and is ready to be released live at any moment, and (2) develop branch, i.e. the branch with features where all tests are performed. The latter can be merged with the former only when all bugs have been fixed and everything tested.
Here, we have enlisted only a few workflows which can advance your development process, however, there are many other workflows, and it is up to your team to decide which is best for the progression of your web project.
If you want to start learning how to use Git, here is their documentation and reference manual, along with Pro Git book and video tutorials.
If you want to allow everyone to see your work, i.e. share your code with other developers, you can fork it on GitHub:
Like this article? Learn more about web development:
Article originally published on www.popwebdesign.net on November 23, 2017.