1.git 存储永久凭据
git config --global credential.helper store
2.git 查询分支或标签的引用
git show-ref 【标签名|分支名】
3.git 搜索关键分支和tag
git tag -l *branch* --sort=committerdate
4.git 删除标签
git tag -d v1.32 删除标签v1.32,参数d是delete的缩写。
5.git 给分支打标签
git tag v1.32 : 给当前分支打上【v1.32】标签
6.git 在tag上拉分支
git checkout -b sdh_1.0_develop refs/tags/sdh1.0
7.git 查询分支来源
git reflog show 分支名
8.git-代码回退
# 查看最近3个提交版本
git log -3
# 重置到想要回滚到的版本号。同时清空工作区、暂存区、repository区的新增变化代码
git reset --hard 61ea89bccc85badbe4c6c967870f3abe6a04b829
# 重置到想要回滚到的版本号。仅仅移动当前 Head 指针,不会改变工作区和暂存区的内容
或
git reset --soft 61ea89bccc85badbe4c6c967870f3abe6a04b829
# 强制提交到git分支
git push -f origin master
9. git-修改分支名
https://blog.csdn.net/weixin_38629529/article/details/125359597
1、重命名分支
git branch -m oldBranch newBranch
注意,如果修改的分支只是在本地,还没有推送到远程,只需要执行该操作即可。后面的操作步骤是针对已经推送到远程的分支。
2、删除远程分支
git push --delete origin oldBranch
3、上传新命名的本地分支
git push origin newBranch
4、本地分支与远程分支关联
git branch --set-upstream-to origin/newBranch
其中,第3、4步命令也可以直接用下面的命令代替。
git push -u origin newBranch