DEV Community

Cover image for An Introduction to Version Control
nyawiraokinda
nyawiraokinda

Posted on

An Introduction to Version Control

Also known as source control.

It is the practice of tracking and managing changes to software code over time. In cases where mistakes have been made, one can go back and compare earlier versions of the code to rectify the mistake.

A version control system(VCS) is software that does version control.

Benefits

  • VCS enables you to track the iterative changes you make to your code. It gives you the freedom to experiment with new ideas but still be able to go back to past versions.

  • It facilitates collaboration. i.e your collaborators can make and save changes to the code, and you can automatically incorporate these changes into the main codebase.

  • One can record messages (commits) as you save each successive version so that you (or anyone else) reviewing the development history of the code is able to understand the rationale for the given changes.

There are different VCS but git is one of the popular ones, it follows the idea of distributed version control. Github on the other hand is a web-based Git repository hosting service. It offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its own features. It is also a social network where people can collaborate with each other on projects and a platform to share projects openly.

Basic Concepts

  • Repository -Collection of files comprising the project.

  • Branch- This allows you to create a copy of the repository that you can modify in parallel without altering the main branch.

  • Forking- Taking a copy of a software code and starting independent development on it creating a distinct piece.

  • Cloning- Copying all of the files from a repository to your local machine.

  • Commit- Submitting the latest changes of the source code to the repository and making them part of the main version of the repository.

  • Merging- Combining the changes i.e from different branches or files into one.

  • 'Diffing'-Viewing the differences between two or more files to see what line of code changed.

Basic Actions

-Add: Put a file into the repo for the first time, i.e. begin tracking it with Version Control

-Pull/push: Copy revisions from one repository into another. Pull is initiated by the receiving repository, while push is initiated by the source.

These are just but a few things to look at.There is still more to be uncovered over time.

Takeaways

  • Use version control- To give yourself a boost since most companies incorporate its use and want people who can work with it. Plus you can interact with other developers to learn/collaborate on projects. It is also worth it for backups(haha) but seriously it is.

  • Keep learning- Start with the basics and pick it up from there. Remember practice makes it easier and better to grasp the concepts and apply them.

  • Consistency is key- Make use of i.e GitHub by being active on it. It helps to build up your portfolio which you can attach when applying for a job. Some recruiters may ask for your account to take a look at the projects you have worked on and be able to gauge your skills.

Resources

Top comments (0)