Commit e4774fe 1 parent 4873643 commit e4774fe Copy full SHA for e4774fe
File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 42
42
# 克隆源仓库的特定分支
43
43
git clone --depth 1 --single-branch --branch "$branch" "$repo_url" "$temp_dir"
44
44
45
+ # 获取源仓库最新提交信息
46
+ cd "$temp_dir"
47
+ latest_commit_hash=$(git log -1 --format="%H")
48
+ latest_commit_date=$(git log -1 --format="%ad" --date=iso)
49
+ latest_commit_msg=$(git log -1 --format="%s")
50
+ cd - > /dev/null
51
+
52
+ echo "Latest commit in $repo_url ($branch):"
53
+ echo " Hash: $latest_commit_hash"
54
+ echo " Date: $latest_commit_date"
55
+ echo " Message: $latest_commit_msg"
56
+
45
57
# 确保目标目录存在
46
58
mkdir -p "$dest"
47
59
69
81
# 如果有变更,添加到 git
70
82
if [[ `git status "$dest" --porcelain` ]]; then
71
83
git add "$dest"
72
- git commit -m "Update $dest from $repo_url ($branch:$src_path)" || true
84
+
85
+ # 创建包含源仓库更新时间的提交消息
86
+ commit_msg="Update $dest from $repo_url ($branch:$src_path)
87
+
88
+ Source commit : $latest_commit_hash
89
+ Update time : $latest_commit_date
90
+ Commit message : $latest_commit_msg
91
+ Synced at : $(date -u "+%Y-%m-%d %H:%M:%S UTC")"
92
+
93
+ git commit -m "$commit_msg" || true
73
94
echo "Changes committed for $dest"
74
95
else
75
96
echo "No changes for $dest"
You can’t perform that action at this time.
0 commit comments