Git code management
A code management tool
To make it easier for you to manage your code, we have deployed a git online tool that you can use without installing a browser.
Introduction to version control system
Version control is a software engineering technique used to manage our history of changes to things such as files, directories, or projects, so that we can easily view the change history and back it up so that previous versions can be restored. It is a technique for managing multi-person collaborative development projects. Version control systems are pieces of software that help keep track of changes made to code over time. When the developer edits the code, the version control system takes a snapshot of the file. It then saves that snapshot permanently so that it can be recalled later as needed.
What is Git
Currently recognized as the world's best distributed version control system, Git has become the global standard for version control.
Git is a distributed version control system, that is, a local clone of the code is a complete version control repository. These full-featured local repositories make it easy to work offline or remotely. Developers commit their work locally and then synchronize the copy of the repository with the copy on the server. This paradigm differs from centralized version control, which requires the client to synchronize code with the server before it can create a new version of the code.
Git's flexibility and popularity make it a great choice for all teams. Many developers and college graduates already know how to use Git. Git's user community has created resources to train developers, and Git's popularity makes it easy to get help when needed. Almost every development environment has Git support and Git command-line tools implemented on all major operating systems.
Git basics
Git creates a commit every time you save a job. A commit is a snapshot of all files at a point in time. If a file doesn't change from one commit to the next, Git uses the previously stored file. This design differs from other systems, which store initial versions of files and keep incremental records over time.
The proposal creates links to other commits, thereby forming a development history graph. You can revert code to previous commits, detect how files change from one commit to the next, and see information such as where and when changes occur. Commits can be identified in Git by a unique encrypted hash of the committed content. Because everything is hashed, you can't make changes, lose information, or corrupt files without detecting Git.
Branch
Each developer saves the changes to their own local code repository. Therefore, there can be many different changes based on the same commit. Git provides tools for isolating changes and putting them back together at a later date. A branch is a lightweight pointer to work in progress that can be used to manage such separations. When the work created in the branch is complete, it can be merged back into the main branch (or backbone) of the team.
Files and submissions
Files in Git are in one of three states: modified, temporary, or committed. The first time a file is modified, the changes exist only in the working directory. They are not yet part of the commit or development history. The developer must temporarily store the changed files to be included in the commit. The staging area contains all changes to be incorporated into the next commit. Once the developer is satisfied that the files have been provisioned, they are packaged as commits with a message describing the changes. This commit becomes part of the development history.
Staging allows developers to select file changes to save in a commit to break up large changes into a series of smaller commits. By reducing the commit scope, you can more easily view the commit history to find specific file changes.
Advantages of Git
Git has many advantages.
Synchronous development
Everyone has their own local copy of the code and can work on their own branch at the same time. Git works offline because almost all operations are local.
Faster release
Branching allows for flexible and simultaneous development. The main branch contains high quality stable code to publish in. The functional branch contains work in progress, which is merged into the main branch when completed. By separating the release branch from ongoing development, it's easier to manage stable code and deliver updates faster.
Built-in integration
Due to its popularity, Git has been integrated into most tools and products. Every major IDE has built-in Git support, and many tools support integration with Git for continuous integration, continuous deployment, automated testing, work item tracking, metrics, and reporting capabilities. This integration simplifies daily workflow.
Strong community support
Git is an open source tool and has become the de facto standard for version control. The tools and resources available to the team are extensive. The amount of community support for Git compared to other version control systems makes it easy to get help when you need it.
Git is for all teams
By encouraging collaboration, enforcing policies, automating processes, and improving visibility and traceability of your work, using Git in conjunction with source code management tools can improve your team's productivity. Teams can determine the individual tools for version control, work item tracking, and continuous integration and deployment. Or, they can choose a solution, such as GitHub or Azure DevOps, to support all of these tasks centrally.
Pull request
Use a pull request to explore code changes with your team before merging them into the main branch. The discussions in the pull request are invaluable in ensuring code quality and enriching knowledge between teams. Platforms like GitHub and Azure DevOps offer a rich pull request experience where developers can browse file changes, comment, detect commits, view internal versions, and vote for code approval.
Branching strategy
Teams can configure GitHub and Azure DevOps to enforce consistent workflows and processes across the team. They can set a branch policy to ensure that the pull request meets the requirements before completion. Branch policies protect important branches by preventing direct push, requiring reviewers, and ensuring clean internal versions.
Git documentation
Detailed documentation can be found in Git Full Command Manual