Use git rebase to merge historical submission and modification records commit message

Time:2021-9-15

Using git for version control is undoubtedly very convenient. You can modify the code at will. Submitting code is what developers do every day. The refreshing submission record is refreshing. In some scenarios, the development will generate some trivial submission records, such as the submission of debugging CI tools and the submission of sporadic bug modifications. These submission records should belong to one record. In this case, the historical submission can be merged through ‘git rebase’.

Use git rebase to merge historical submission and modification records commit message

Merge history submission

I used to use ‘git commit — amend — no edit’ to merge submission records. It will merge the latest submission record with the previous submission record. The applicable scenarios are limited.

Use git rebase to merge historical submission and modification records commit message

In the scenario in the figure above, the submission history contains multiple submissions of debug CIS, and the submission of debug CIS is not the latest submission. In this case, the purpose of merging historical submissions can be achieved through the ‘git rebase’ command. Type ‘git rebase -i head ~ 5′ to enter the interactive page of rebase. In this scenario, I want to view the first 5 submissions of the current head, so it is’ head ~ 5 ‘. In addition, the ` git rebase – I — root ‘command can select the range for all submitted records.

Use git rebase to merge historical submission and modification records commit message

According to the information in commands, merge history submission should be marked with’s’, which will merge the marked submission record to the previous submission record.

Modify record commit message

Use git rebase to merge historical submission and modification records commit message

The above figure shows the effect of merging historical submission records. The ‘git rebase’ command integrates trivial submission records into one. The submission records look much cleaner. Take a closer look. There is an error in the commit message of the debugging CI tool. You should use the chord type. At this time, you can continue to use the ‘git rebase’ command to modify the commit message. According to the commands just now, the “R” flag should be used in the scene of modifying the record commit message. It will only modify the commit message and will not affect the submitted content. Finally, the modified results are shown in the figure below.

Use git rebase to merge historical submission and modification records commit message

Original link: https://dukeluo.me/2020/05/07/git-rebase.html

Recommended Today

Beautify your code VB (VBS) code formatting implementation code

However, vb.net does have many new functions that VB6 does not have. The automatic typesetting of code is one, which is the function we want to realize today – VB code formatting.Let’s look at the effect: Before formatting: Copy codeThe code is as follows: For i = 0 To WebBrowser1.Document.All.length – 1 If WebBrowser1.Document.All(i).tagName = […]