Tracking method and device for automatically associating branch key information, equipment and medium

By extracting and converging key information of branch names in Git hooks, the problem of difficult to track original branches and specification commits is solved, and efficient code change history tracking and team collaboration are achieved.

CN120407013AInactive Publication Date: 2025-08-01CHENGDU YUBUO TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510927377.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-07
Publication Date
2025-08-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, it is difficult to accurately grasp the modification background of past codes for submitted information, it is difficult to track its original branch through submitted information, and it is difficult for users to submit key information in accordance with the established specifications.

Method used

By initializing the hook information in the Git hook, obtaining the branch name and extracting key information using regular expressions, fusing it into the original commit information, forming a detailed commit record.

Benefits of technology

Improves the efficiency of tracing code changes historical backgrounds, enhances code maintainability, promotes team collaboration and communication, and reduces misunderstandings and duplicate work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407013A_ABST
    Figure CN120407013A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of software development, and discloses a tracking method and device for automatically associating branch key information, equipment and a medium, the method comprises the following steps: initializing hook information in a target project which has a plurality of branch names; acquiring a branch name of the target project based on the hook information; performing information extraction on each branch name based on a preset matching algorithm to obtain key information corresponding to each branch name; acquiring original submission information of the user; and fusing the original submission information with the key information corresponding to the branch name to obtain a submission record which is used for tracking the key information and the branch name. According to the method, the code change historical background tracking efficiency is improved, the code maintainability is enhanced, and the fluency of team cooperative communication is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of software development, and in particular relates to a method, device, equipment and medium for automatically tracking key information of associated branches. Background Art

[0002] Commit messages are text records used in the Git version control system to describe code changes. They are a core tool for maintaining project history, tracking issues, and facilitating team collaboration. Essentially, they document the purpose, scope, and impact of each code change through structured text, providing traceability for subsequent development, debugging, and auditing. Therefore, developers often record the logic of their code changes in commit messages to facilitate subsequent issue tracking and location.

[0003] However, the existing submission information still has at least the following problems in actual application: 1. After a long period of code iteration, personnel changes and lack of effective records of key information may make it difficult for subsequent developers to accurately grasp the modification context of the previous code; 2. The branch name of the original branch in the commit message may contain some information related to the requirement, but using the existing commands provided by Git, it is difficult to trace its original branch through the commit message; 3. Users’ proficiency levels vary, making it difficult to submit key information according to established specifications. Summary of the Invention

[0004] The purpose of the present invention is to provide a tracking method, device, equipment and medium for automatically associating branch key information, so as to solve the problems existing in the prior art of difficulty in accurately grasping the modification background of past code, difficulty in tracing its original branch through submission information, and difficulty in submitting key information according to established specifications.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions: In a first aspect, the present invention provides a method for tracing key information of automatic association branches, the method comprising: Initialize hook information in a target project, wherein the target project has a plurality of branch names; Get the branch name of the target project based on the hook information; Extract information from each branch name based on a preset matching algorithm to obtain the key information corresponding to each branch name; Get the user's original submission information; The original commit information is merged with the key information corresponding to the branch name to obtain a commit record, which is used to track the key information and the branch name.

[0006] Preferably, the method further comprises: Obtain the tracking query request of the user; In response to the tracking query request, extract the required key information from the submission record; Based on the required key information, determine the branch name, and use the key information and the corresponding branch name as the tracking result.

[0007] Preferably, the key information at least includes: task number and problem identifier.

[0008] Preferably, the hook information includes: commit-msg hook.

[0009] Preferably, the preset matching algorithm is a regular expression.

[0010] Preferably, fuse the original submission information with the key information corresponding to the branch name to obtain a submission record, including: Construct a predetermined fusion format; Based on the predetermined fusion format, fuse the original submission information with the key information corresponding to the branch name to obtain a submission record.

[0011] In a second aspect, the present invention provides a tracking device for automatically associating branch key information, which is used to implement the above-mentioned tracking method for automatically associating branch key information. The device includes: A hook deployment module, which is used to initialize hook information in a target project, and there are several branch names in the target project; A first acquisition module, which is used to obtain the branch names of the target project based on the hook information; An information extraction module, which is used to extract information from each branch name based on a preset matching algorithm to obtain the key information corresponding to each branch name; A second acquisition module, which is used to obtain the original submission information of the user; An information fusion module, which is used to fuse the original submission information with the key information corresponding to the branch name to obtain a submission record, and the submission record is used to track the key information and the branch name.

[0012] Preferably, the device further includes: A third acquisition module, which is used to obtain the tracking query request of the user; An information search module, which is used to extract the required key information from the submission record in response to the tracking query request; A branch search module, which is used to determine the branch name based on the required key information, and use the key information and the corresponding branch name as the tracking result.

[0013] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned tracking method for automatically associating branch key information is implemented.

[0014] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the above-mentioned tracking method for automatically associating branch key information is implemented.

[0015] Advantageous effects: 1. The present invention improves the efficiency of tracking the historical background of code changes: By incorporating the key information of branches into the commit information, developers can quickly locate the task number or issue identifier corresponding to a specific code change without blindly searching through a large amount of code and complex commit records, greatly reducing the time cost of tracking the historical background of code changes and improving development efficiency. 2. The present invention enhances the maintainability of code: The detailed commit records with clear key information enable developers newly added to the project or those conducting code reviews to quickly understand the reasons and purposes of code changes, reducing the difficulty of code maintenance and ensuring the long-term maintainability of the project. 3. The present invention improves the fluency of team collaboration and communication: When different users view the commit records, they can understand each other's work content and intentions based on unified and clear key information, reducing misunderstandings and duplicate work caused by poor communication, and strengthening the fluency and synergy of team collaboration. Description of the Drawings

[0016] The drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. They are used together with the following specific embodiments to explain the embodiments of the present invention, but do not limit the embodiments of the present invention. In the drawings: Figure 1 is a flowchart of the tracking method for automatically associating branch key information provided by an embodiment of the present invention; Figure 2 is a block diagram of the tracking device for automatically associating branch key information provided by an embodiment of the present invention. Detailed Embodiments

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the present invention in combination with the accompanying drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the accompanying drawings is only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings. It should be noted here that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation to the present invention.

[0018] Embodiment 1 Figure 1 is a flowchart of a method for tracking automatically associated branch key information provided by an embodiment of the present invention. As Figure 1 shown, this embodiment provides a method for tracking automatically associated branch key information, and the method includes: Step S10: Initialize hook information in the target project, where there are several branch names in the target project.

[0019] In this embodiment, the hook information is the Git hook. The Git hook is a special script that can be automatically executed at a specific time point of a Git event. Among them, Git is an open-source distributed version control system that allows developers to effectively manage the versions and history of code. The Git hook is based on the commit-msg hook.

[0020] In this embodiment, the target project is software code. By deploying the Git hook in the target project, when the user modifies the commit information, it is automatically triggered to execute the subsequent steps S20 to S50.

[0021] In this embodiment, the branch name is a naming tag used to identify different code lines, and mainly has the following functions: Distinguish code lines: Different branch names are used to distinguish different code lines, such as development branches, test branches, release branches, etc.; Parallel development: Branches allow developers to develop in parallel on different code lines without interference; Version control: Branches can be used to manage different versions of code, such as development versions, test versions, release versions, etc.

[0022] The naming of branch names has the following specifications: Concise and clear: The branch name should be concise and clear, easy to understand and remember; Semantic: The branch name should be semantic and can reflect the function or use of the branch; Consistency: The team should follow a consistent branch naming specification for easy management and understanding.

[0023] Common branch names include: Main branch: Usually named "main" or "master", used to store the stable version of the project; Development branch: Usually named "develop" or starting with "feature / ", used for the development of new features, e.g., "feature / task number - feature description"; Hotfix branch: Usually starting with "bugfix / ", used to fix bugs in the code, e.g., "bugfix / issue number - fix content".

[0024] Step S20: Obtain the branch name of the target project based on the hook information.

[0025] Step S30: Extract information from each branch name based on a preset matching algorithm to obtain the key information corresponding to each branch name.

[0026] In this embodiment, since the branch name has a specific specification, e.g., formats like "feature / task number - feature description", "bugfix / issue number - fix content", etc., the branch name is analyzed and expanded through the matching algorithm to extract key information in each branch name, such as key information like task number and issue identifier.

[0027] For example: Facing a branch name like "feature / 1234-xxx", the key information of the task number "1234" can be extracted.

[0028] In this embodiment, the preset matching algorithm is a regular expression. A regular expression (RegularExpression) is a powerful text matching tool that uses a series of special characters and symbols to describe and match patterns in strings.

[0029] The core of the regular expression: Pattern matching: The regular expression defines the text pattern to be matched, such as a specific character sequence, word, or phrase; Text parsing: The regular expression compares the input text string with the regular expression pattern to find the matching part; Matching operations: The regular expression performs various operations, such as matching, replacing, extracting substrings, etc.

[0030] Common regular expression symbols include: ".": Matches any single character except the newline character; "*": Matches the previous character zero or more times; "+": Matches the previous character one or more times; "?" : Matches the preceding character zero or one time; "{n}" : Matches the preceding character n times; "{n,}" : Matches the preceding character at least n times; "{n,m}" : Matches the preceding character at least n times and at most m times; "^" : Matches the start of the string; "$" : Matches the end of the string; "[]" : Matches any single character specified within the brackets; "[^]" : Matches any single character not specified within the brackets; "()" : Grouping, used to treat multiple characters as a single unit; "|" : Selection, matches either the left expression or the right expression.

[0031] Step S40: Obtain the user's original submission information.

[0032] Step S50: Integrate the original submission information with the key information corresponding to the branch name to obtain a submission record, which is used to track the key information and the branch name.

[0033] In this embodiment, integrating the original submission information with the key information corresponding to the branch name to obtain a submission record includes: Step S501: Construct a predefined integration format.

[0034] Step S502: Based on the predefined integration format, integrate the original submission information with the key information corresponding to the branch name to obtain a submission record.

[0035] In this embodiment, when the key information is successfully extracted, it will automatically be integrated with the original submission information input by the developer according to the specifications of the predefined integration format. The integrated submission information retains both the original description and incorporates the key information.

[0036] Assume the original submission information is "feat: This is a test submission". After merging with the extracted key information "1234", the final submission information becomes "

[1234] feat: This is a test submission". Using "

[1234] feat: This is a test submission" as the submission record, the format of "

[1234] feat: This is a test submission" is the predefined integration format.

[0037] As a further optimization of this embodiment, the method further includes: Step a10: Obtain the user's tracking query request.

[0038] Step a20: In response to the trace query request, extract the required key information from the commit record.

[0039] Step a30: Based on the required key information, determine the branch name, and use the key information and the corresponding branch name as the trace result.

[0040] In this embodiment, since the merged commit information retains both the original description and incorporates the key information, users can query the modification history based on the commit record.

[0041] Therefore, the present invention has the following advantages: 1. Improve the efficiency of tracing the historical background of code changes: By incorporating key information into the commit information, developers can quickly locate the task number or issue identifier corresponding to a specific code change without blindly searching through a large amount of code and complex commit records. For example, when troubleshooting problems with a certain function, with the help of the task number in the commit information, the corresponding development task can be directly associated, greatly reducing the time cost of tracing the historical background of code changes and improving development efficiency.

[0042] 2. Enhance code maintainability: Detailed commit records with clear key information enable developers newly added to the project or those conducting code reviews to quickly understand the reasons and purposes of code changes. For example, when reading a record like "

[1234] feat: This is a test commit", it is clear that this commit is related to the task numbered 1234, which helps maintainers better grasp the code context, reduces the difficulty of code maintenance, and ensures the long-term maintainability of the project.

[0043] 3. Optimize the project management process: At the project management level, querying historical requirements using the key information / task number in the commit record enables managers to clearly understand the development progress, code change status, and work results at different stages of each task. This provides an accurate basis for project planning, resource allocation, and risk assessment, helps optimize the project management process, and ensures the smooth progress of the project.

[0044] 4. Facilitate team collaboration and communication: Standardized commit information rich in key information builds an efficient communication bridge among team members. When different members view the commit record, they can understand each other's work content and intentions based on unified and clear key information, reducing misunderstandings and duplicate work caused by poor communication, and strengthening the fluency and synergy of team collaboration.

[0045] Embodiment Two Figure 2It is a block diagram of a tracking device for automatically associating branch key information provided by an embodiment of the present invention. As Figure 2 shown, this embodiment provides a tracking device for automatically associating branch key information, which is used to implement the method for tracking automatically associating branch key information in the first embodiment. The device includes: a hook deployment module, a first acquisition module, an information extraction module, a second acquisition module, and an information fusion module, and further includes: a third acquisition module, an information search module, and a branch search module.

[0046] The hook deployment module is used to initialize hook information in a target project, and there are several branch names in the target project.

[0047] In this embodiment, the hook information is the Git hook. The Git hook is a special script that can be automatically executed at specific time points of Git events. Among them, Git is an open-source distributed version control system that allows developers to effectively manage the versions and history of code. The Git hook is based on the commit-msg hook.

[0048] In this embodiment, the target project is software code. By deploying the Git hook in the target project, it is automatically triggered when the user modifies the commit information.

[0049] The first acquisition module is used to acquire the branch names of the target project based on the hook information. The common branch names are: Master branch: Usually named "main" or "master", which is used to store the stable version of the project; Development branch: Usually named "develop" or starting with "feature / ", which is used for the development of new features. For example: "feature / task number - function description"; Fix branch: Usually named starting with "bugfix / ", which is used to fix errors in the code. For example: "bugfix / issue number - fix content".

[0050] The information extraction module is used to extract information from each branch name based on a preset matching algorithm to obtain the key information corresponding to each branch name.

[0051] In this embodiment, since the branch names have specific specifications, such as formats like "feature / task number - function description", "bugfix / issue number - fix content", etc., the matching algorithm is used to expand and analyze the branch names to extract key information in each branch name, such as key information like task numbers and issue identifiers.

[0052] For example, for a branch name like "feature / 1234-xxx", the key information of the task number "1234" can be extracted.

[0053] In this embodiment, the preset matching algorithm is a regular expression. A regular expression is a powerful text matching tool that uses a series of special characters and symbols to describe and match patterns in strings.

[0054] The second acquisition module is used to acquire the original submission information of the user.

[0055] The information fusion module is used to fuse the original submission information with the key information corresponding to the branch name to obtain a submission record, and the submission record is used to track the key information and the branch name.

[0056] In this embodiment, after the key information is successfully extracted, it will automatically be fused with the original submission information input by the developer according to the established information fusion format specification. The fused submission information not only retains the original description but also incorporates the key information.

[0057] Assume the original submission information is "feat: This is a test submission". After merging with the extracted key information "1234", the final submission information becomes "

[1234] feat: This is a test submission", and "

[1234] feat: This is a test submission" is used as the submission record.

[0058] The third acquisition module is used to acquire the user's tracking query request. The information search module is used to respond to the tracking query request, extract the required key information from the submission record, and the branch search module is used to determine the branch name based on the required key information, and the key information and the corresponding branch name are used as the tracking result.

[0059] In this embodiment, since the fused submission information not only retains the original description but also incorporates the key information, the user can query the modification history according to the submission record.

[0060] This embodiment also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the tracking method for automatically associating branch key information in Embodiment 1.

[0061] This embodiment also provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by the processor, it implements the tracking method for automatically associating branch key information in Embodiment 1.

[0062] 1. Improve the efficiency of tracking the historical background of code changes: By incorporating key information into the commit messages, developers can quickly locate the task number or issue identifier corresponding to a specific code change without blindly searching through a large amount of code and complex commit histories. For example, when troubleshooting issues with a certain function, with the help of the task number in the commit message, one can directly associate it with the corresponding development task, greatly reducing the time cost of tracing the historical background of code changes and improving development efficiency.

[0063] 2. Enhance code maintainability: Detailed commit records with clear key information enable developers newly joining the project or those conducting code reviews to quickly understand the reasons and purposes of code changes. For example, when reading a record like "

[1234] feat: This is a test commit", it is clear that this commit is related to task number 1234. This helps maintainers better grasp the code context, reduces the difficulty of code maintenance, and ensures the long-term maintainability of the project.

[0064] 3. Optimize project management processes: At the project management level, querying historical requirements using the key information / task numbers in the commit records enables managers to clearly understand the development progress of each task, code change situations, and work results at different stages. This provides an accurate basis for project planning, resource allocation, and risk assessment, helps optimize project management processes, and ensures the smooth progress of the project.

[0065] 4. Facilitate team collaboration and communication: Standardized commit messages rich in key information build an efficient communication bridge among team members. When different members view the commit records, they can understand each other's work content and intentions based on unified and clear key information, reducing misunderstandings and duplicate work caused by poor communication, and strengthening the fluency and synergy of team collaboration.

[0066] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, apparatuses, or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program code.

[0067] This application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (devices), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, as well as the combination of flows and / or blocks in the flowchart and / or block diagram. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing device generate means for implementing the functions specified in one flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or means for implementing the functions specified in one block or multiple blocks.

[0068] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. An automatic correlation tracking method for branch key information, characterized in that The method includes: Initializing hook information in a target project, where there are several branch names in the target project; Obtaining the branch names of the target project based on the hook information; Performing information extraction on each branch name based on a preset matching algorithm to obtain the key information corresponding to each branch name; Obtaining the original submission information of the user; Fusing the original submission information with the key information corresponding to the branch name to obtain a submission record, which is used to track the key information and the branch name.

2. The method for tracking automatically associated branch key information according to claim 1, characterized in that The method further includes: Obtaining the tracking query request of the user; Responding to the tracking query request and extracting the required key information from the submission record; Based on the required key information, determining the branch name, and using the key information and the corresponding branch name as the tracking result.

3. The tracking method for automatically associating branch key information according to claim 1 or 2, characterized in that, The key information at least includes: task number and problem identifier.

4. The tracking method for automatically associating branch key information according to claim 1, wherein The hook information includes: commit-msg hook.

5. The tracking method for automatically associating branch key information according to claim 1, characterized in that The preset matching algorithm is a regular expression.

6. The tracking method for automatically associating branch key information according to claim 1, characterized in that, Fusing the original submission information with the key information corresponding to the branch name to obtain a submission record, including: Constructing a predetermined fusion format; Fusing the original submission information with the key information corresponding to the branch name based on the predetermined fusion format to obtain a submission record.

7. A tracking device for automatically associating branch key information, which is used to implement the tracking method for automatically associating branch key information according to any one of claims 1-6, characterized in that The device includes: A hook deployment module for initializing hook information in a target project, where there are several branch names in the target project; A first acquisition module for obtaining the branch names of the target project based on the hook information; An information extraction module for performing information extraction on each branch name based on a preset matching algorithm to obtain the key information corresponding to each branch name; A second acquisition module for obtaining the original submission information of the user; An information fusion module for fusing the original submission information with the key information corresponding to the branch name to obtain a submission record, which is used to track the key information and the branch name.

8. The tracking device for automatically associating branch key information according to claim 7, wherein The device further includes: A third acquisition module for obtaining the tracking query request of the user; An information search module for responding to the tracking query request and extracting the required key information from the submission record; A branch search module for determining the branch name based on the required key information, and using the key information and the corresponding branch name as the tracking result.

9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the tracking method for automatically associating branch key information according to any one of claims 1-6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the tracking method for automatically associating branch key information according to any one of claims 1-6.