blog-commit自动注释

日常操作
Article Directory

GitHub 一键推送博客并自动注释新增文章名称

这篇文章其实主要是为了测试。自动 commit 时显示中文的问题。刚刚,突然发现,推送上去的中文字符都是被转义过的,于是,重新发一篇来测试一下。

就直接把脚本拿出来了,因为自己用,所以并没有做严格的容错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
echo "default commit to current branch the first remote ";
git config --global core.quotepath false
v_detail=$(git status --porcelain | sed $'s/\"/\\"/g' );

v_test=$(echo $v_detail | grep ^fatal:.* )

if [ ! -z $v_test ];then
echo "do you sure this is a git repostory???"
read -n 1 i;
exit;
fi

v_branch=$(git branch | grep ^\*.* | awk '{print $2}');
v_remote=$(git remote show | awk -n '1p');


echo "on branch=> $v_remote:$v_branch";

git add .
git commit -m "$v_detail";

if [ -z $v_remote ];then
echo 'have no found remote address!!'
read -n 1 i;
exit;
fi

git push "$v_remote" "$v_branch"

Author: 哒琳

Permalink: http://blog.jieis.cn/2022/36cb2d3f-a9a6-4fac-ba4e-766fb13e34c6.html

Comments