What are version control systems?
A version control system (VCS), also known as a source control system or revision control system, is a software tool that helps developers manage changes to their source code and other files. It provides a structured approach to track, document, and control different versions of files, enabling collaboration, facilitating team workflows, and ensuring code integrity.
UiPath projects are typically developed using external version control systems to manage source code and track changes over time.
You can use any version control system that suits your requirements, such as Git, SVN (Subversion), or TFS (Team Foundation Server). UiPath projects are usually stored as collections of files, including workflow files (.xaml), configuration files, and other supporting files.
Benefits of Version Control System
History and Version Tracking
Version control systems keep a complete history of all changes made to files, allowing developers to track and view the evolution of the codebase.
Collaboration and Teamwork
Version control systems facilitate collaboration among team members working on the same project. Multiple developers can work on different branches, make changes, and merge them back into the main codebase.
Branching and Merging
Version control systems allow developers to create branches, which are independent lines of development. Branches enable the isolation of new features or experimental changes from the main codebase, providing a safe space for development without affecting the stability of the main branch. Branches can be merged back into the main branch once the changes are tested and approved.
Code Integrity and Backup
Version control systems maintain code integrity by documenting, reviewing, and validating changes before integration. They minimize the risk of errors and serve as backups by storing the project's complete history for easy reversion to previous versions.
Traceability and Auditing
Version control systems provide traceability by associating each change with relevant information, such as the reason for the change, associated issues or tickets, and the person responsible. This traceability aids in auditing, compliance, and helps in understanding the context behind specific modifications.
Experimentation and Rollbacks
With version control systems, developers can experiment with new ideas, features, or improvements without fear of damaging the existing codebase. If an experiment doesn't work out as expected, it's easy to roll back to a previous known good state and continue from there.
Code Reviews and Continuous Integration
Version control systems seamlessly integrate with code review and continuous integration/delivery tools. They facilitate systematic code reviews, improving code quality and knowledge sharing. By setting up continuous integration workflows, code changes can be automatically built, tested, and deployed upon each commit, streamlining the development process.
What factors should you consider when selecting a version control system?
Irrespective of the version control system type, project files are stored on a server where you upload your completed work from your local machine. The choice between a centralized version control system like SVN and a distributed version control system like Git impacts the process of committing changes. We will discuss this further in the upcoming sections of the course.
What are the most commonly used version control systems that can be integrated with UiPath Studio?
Git, TFS, and SVN are the version control systems that integrate with UiPath Studio. Users establish the connection to a version control system at the project level.
What I need to do to manage the connection?
To manage your connections, access Studio, go to the Backstage view, and click on the Team tab
How to access the shortcuts?
The Add to Source Control button in the status bar offers shortcuts to Git Init, Copy to Git, Add to TFS, and Add to SVN.
Git Overview
Git, an open-source distributed version control system, empowers users to efficiently and collaboratively manage source code and project files. It actively tracks changes to files, enabling easy switching between different versions, branch creation for experimentation, merging of changes, and seamless collaboration. Git facilitates both local and remote work, making it convenient for individual developers and teams alike. It offers numerous benefits, including version history, streamlined rollback, conflict resolution, and seamless integration with popular development platforms. Its flexibility, speed, and robustness have established Git as the de facto standard for version control in the software development industry.
Additionally, Git provides excellent support for branching, merging, and repository history rewriting, with the added advantage of the widely-used pull request feature that facilitates efficient code review and collaboration within teams. As the most widely adopted version control system globally, Git has solidified its position as the modern standard in software development.
How Git works?
Here is a basic overview of how Git works:
- Create a repository (project) with a Git hosting tool.
- Copy or clone the repository to your local machine.
- Add a file to your local repository and commit (save) the changes locally.
- Push your changes to the remote repository.
- Pull the file to local repository and make changes, and then commit and push the file.
- Create a branch (alternative), make a change, commit the change.
- Open a pull request (propose changes to the master branch).
- Merge your branch to the master branch.
Comparing SVN and Git Side-by-Side
SVN (Subversion) and Git are both popular version control systems used in software development. While they serve similar purposes, they differ in their underlying architecture, workflow models, and features. Here's a comparison of SVN and Git:
SVN | GIT | |
Architecture | SVN is a centralized version control system, where a central repository stores the entire history and versions of files. Developers typically check out a working copy from the central repository, make changes, and commit them back. | Git is a distributed version control system, where each developer has a complete local copy of the repository. This allows developers to work independently and commit changes locally before synchronizing them with remote repositories. |
Branching and Merging | SVN supports branching and merging, but it follows a copy-modify-merge approach. Each branch is essentially a copy of the trunk or another branch, and developers merge changes back to the main branch manually. | Git provides powerful branching and merging capabilities. Branches are lightweight and can be created and merged easily. Git allows for various branching strategies (such as feature branches, release branches, etc.) and provides efficient merging mechanisms. |
Performance | SVN performs well for smaller repositories and projects with fewer files. However, as the repository size grows, SVN's centralized architecture can lead to slower operations, especially for tasks like history traversal. | Git is designed to handle large repositories efficiently, thanks to its distributed nature. Most operations are performed locally, making Git faster for common tasks such as committing, branching, merging, and switching between branches. |
Offline Work | SVN requires a network connection to the central repository for most operations. Working offline is limited, as you need network access to commit changes or access the repository's full history. | Git enables full offline work since each developer has a complete local repository copy. Developers can commit changes and access the repository's history without network connectivity. |
Community and Ecosystem | SVN has a mature user base and a well-established ecosystem. It has been around for a longer time, and there are many tools and integrations available for SVN. | Git has gained immense popularity and has a larger user community. It has a vast ecosystem with a wide range of tools, services, and integrations built around it. |
Working with Git in Studio
Best Practices
- Developers should work separately on feature branches.
- Merging into the develop branch should be done via Pull Request.
- The main branch is reserved for code that reaches the Production environment.
- Code should reach the main branch only through Pull Request and at least one approval, typically from the Solution Architect.
- Development should take place exclusively on feature branches.
- Each important feature implemented should have its own branch.
- It is preferable to have a developer working alone on a feature branch.
- Code should be merged into the develop branch through Pull Requests.
Source: UiPath Academy