Git常用仓库相关命令

原创
2019/06/22 05:29
阅读数 94

常用仓库相关命令

  • 仓库命令
1.远程仓库
查看已经存在的远程仓库
git remote

查看已经存在的远程仓库的详细信息 > 列举出URL
git remote -v

添加远程仓库
git remote add <shortName> <url>
要抓取所有 远程 有的,但本地仓库没有的信息,可以运行 git fetch shortName

删除远程仓库,在本地的追踪
git remote remove <shortName>

重命名远程仓库,在本地的别名
git remote rename <oldName> <newName>

查看远程仓库详细信息,及其远程分支,本地分支追踪状况等信息
git remote show <showrtName>如: origin 
  • 注释
注释:
通过git remote 方式添加远程仓库
看情况执行需不需要用户名{
git config --global user.name "Name"
	git congif --global user.email "Email"
}
1.在当前文件夹初始化本地仓库
git init 

2.为本地仓库添加一个远程仓库
git remote add origin  sshUrl 为当前的本地仓库, 新建一个远程分支sshUrl 别名为origin

3.设置本地的master分支追踪远程分支
git checkout -b master --track origin/master
展开阅读全文
加载中

作者的其它热门文章

打赏
0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部