Git系列:各种场景需求下对应的Git命令

  • 本来网上已经有很多博客,是关于Git命令的,但是五花八门,很多都是过期的,也没有更新。有些命令格式不对,复制过去还报错。所以还是得靠自己。博客使用的Git版本:2.29.2

查看git 版本

git version

创建远程分支,并且推送本地分支到远程分支

git checkout -b my-test  //在当前分支下创建my-test的本地分支分支
git push origin my-test  //将my-test分支推送到远程
git branch --set-upstream-to origin/my-test //将本地分支my-test关联到远程分支my-test上   
git branch -a //查看远程分支 

修改本地分支的关联,将本地分支关联到另外一个远程分支

git branch --set-upstream-to origin/1.4.6bugfix

不需要输入当前本地分支的名称,默认就是当前分支。
成功后显示:

C:\xx\xx\workspace\project>git branch --set-upstream-to origin/1.4.6bugfix
Branch '1.4.6bugfix' set up to track remote branch '1.4.6bugfix' from 'origin'.

无法拉取远程代码,报错:unable to access ‘https:/xxxxxxx.git/’: SSL certificate problem: certificate has expired

git config --global http.sslVerify false

原理还待研究

猜你喜欢

转载自blog.csdn.net/zhangjin1120/article/details/113738968