Post

git

git

代理

可以 windowns 开启 vpn

linux 配置:

1
2
3
git config --global http.proxy http://<Windows_IP>:<port>

git config --global https.proxy http://<Windows_IP>:<port>

分支

创建分支
git checkout <branch-name>

创建并切换到该分支
git checkout -b <branch-name>

删除本地分支
git branch -d <branch-name>

删除远程分支
git push origin --delete <branch-name>

从某个tag/commit切新分支
git checkout -b <new-branch-name> <tag-or-commit-hash>

git push origin <new-branch-name>

github push 失败

git config --global --unset http.proxy 
git config --global --unset https.proxy

cmd下执行 ipconfig/flushdns

更新submodules

# git A 包含子模块B,远端B更新,A的子模块B更新到B的某次提交
git submodule init
git submodule update

进入子模块 B 的目录:
cd B

# 在子模块 B 中,切换到远程 B 的特定提交。你可以使用 git checkout 命令,指定远程 B 的提交哈希值或分支名:
git checkout <commit_hash_or_branch_name>
例如,如果你想要将子模块 B 更新到远程 B 的 main 分支的最新提交,可以运行:
git checkout main

返回到父仓库 A 的根目录:
cd ..

提交父仓库 A 中子模块 B 的更新:
git add B
git commit -m "Update submodule B to specific commit"

最后,将父仓库 A 推送到远程仓库(如果需要):
git push origin <branch_name>

tag

# 查看 tag
git tag

# 添加 tag
git tag v1.0

# 附加信息
git tag -a v1.0 -m "版本 1.0"

# 提交
git push origin v1.0

# 根据tag创建分支

####

source tree

SourceTree使用详解(连接远程仓库,克隆,拉取,提交,推送,新建/切换/合并分支,冲突解决)-腾讯云开发者社区-腾讯云 (tencent.com)

This post is licensed under CC BY 4.0 by the author.