git

git #

push #

推送同名分支 #

bash
# 将本地分支 abc 推送到远程仓库 origin 的 abc 分支上(若远程分支不存在则创建)
git push origin abc

推送不同名分支 #

bash
# 将本地分支 abc 推送到远程仓库 origin 的 abcdef 分支上(若远程分支不存在则创建)
git push origin refs/heads/abc:refs/heads/abcdef
# 简化写法:
git push origin abc:abcdef

# 可以添加 -u/--set-upstream 参数,绑定本地分支和远程分支

删除远程分支 #

bash
# 删除远程仓库 origin 的 abcdef 分支
git push origin :refs/heads/abcdef

submodule #

bash
# 添加子模块
git submodule add [--] URL path/to/submodule
2025年8月20日