git branch 和 git checkout 分支
git branch -a
git checkout `remotes/origin/branch-name` -b `origin/branch-name` # 切换并创建新本地分支
git branch --set-upstream-to=origin/main # 将当前分支跟踪到远程origin/main分支
patch 补丁
git format-patch -1
git diff &> diff.patch
git apply [name].patch
git am [name].patch
git add -u
git commit -s --amend
git commit -m "[some logs]"
git push
git reset 和 git checkout 回退
git reset --hard e85be088dd4023edaa
git checkout e85be088dd4023edaa target/loongarch/helper.c #文件回退到某个版本
git apply有冲突时
git am xxx.patch # 尝试直接打入补丁
git apply –reject xxx.patch # 自动合入 patch 中不冲突的代码改动
vim xxx.rej
git add -u
git am --continue
git pull手动修改冲突
git add -u
git stash
git pull
git stash pop
git status
vim # 修改冲突文件
git log 日志
git log -L :runOnModule:lib/Analysis/CallGraphSCCPass.cpp
git log --author=authorname
delete commit
git reset --hard commit_id # HEAD 就会指向此次的提交记录
git push origin HEAD --force # 强制推送到远端
git clean
git clean -d -f .
#-n, --dry-run