config配置
# 配置列表
$ git config --list
credential.helper=osxkeychain
user.name=LarryDpk
user.email=larry@xxx.com
# 设置某个属性
$ git config [--global] user.name "LarryDpk"
$ git config [--global] user.email "larry@xxx.com"
Branch分支
# 列出本地分支
$ git branch
* main
# 列出本地和远程所有分支
$ git branch -a
* main
remotes/origin/HEAD -> origin/main
remotes/origin/main
# 列出远程的分支
$ git branch -r
origin/HEAD -> origin/main
origin/main
# 新建分支
$ git branch develop
# 新建分支并切换
$ git checkout -b develop
# 删除分支
$ git branch -d develop
# 删除远程分支
$ git push origin --delete develop
tag操作
创建tag:
$ git tag v1.0.1 main
列出tag:
$ git tag
v1.0.0
v1.0.1
推送tag到远程:
$ git push origin v1.0.0
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:LarryDpk/xxx.git
* [new tag] v1.0.0 -> v1.0.0
删除本地的tag:
$ git tag -d v1.0.0
Deleted tag 'v1.0.0' (was a600b18)
删除远程tag:
$ git push --delete origin v1.0.0
To github.com:LarryDpk/xxx.git
- [deleted] v1.0.0
References: