路漫漫其修远兮, 吾将上下而求索
题记
git clone 只克隆最近的
git clone -b xxxx --depth 1
patch
git format-patch --root -o patches HEAD
git format-patch -1 xxxxx -o ./patches/
am patch
git am ./patches/*.patch
apply path
git apply --reject ./patches/*.patch
am补丁出错
csplit -f patch-part -b %02d.patch your-large-patch.patch '/^diff --git/' {*}
写commmit的changeId
git clone github.com/newren/git-…
git filter-repo --commit-callback '
if not "Change-Id" in commit.message:
# 调用 commit-msg 钩子来添加 Change-Id
import subprocess
subprocess.run([".git/hooks/commit-msg", commit.path], check=True)
'
git filter-branch --env-filter '
if [ "$GIT_AUTHOR_EMAIL" = "old.email@example.com" ]; then
GIT_AUTHOR_NAME="New Author Name"
GIT_AUTHOR_EMAIL="new.email@example.com"
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
fi' --tag-name-filter cat -- --branches --tags
修改最近的一个commit提交信息
git commit --amend
修改一个commit的author
git am --amend author="xxxxx<xxxx.com>"