Use bash script to submit git's own comment information

Background: Every time you submit git, you must write a comment. In some cases, the comment is not easy to write, or it is not necessary at all. At this time, you can use the automatic comment method, such as which files can be added and modified.

Solution: Through the shell script, write git commands in the script, add commit push, etc., get the git status when committing, refer to the following script.

#!/bin/bash
 
#execute git command
note=`git status`
git status
git add .
git commit -am "$note"
git pull --rebase
git push
#! /bin/bash

note=`git status`
git commit -m "$note"
git push

Through git log, you can view the log you just submitted and see which files have been modified.

Of course, all the information you want to bring can be added, which is convenient for follow-up investigation. Git has the function of querying according to the log.

Transfer from: https://www.cnblogs.com/xiaogangfan/p/9100421.html

Guess you like

Origin blog.csdn.net/qq_45467083/article/details/109688959
Recommended