git 新建仓库,添加远程分之到本地

  1. 本地不存在仓库拉取远程分之
  2. 本地已有的仓库添加到远程
  3. git本地分支和远程分支改名

本地不存在仓库拉取远程分之

$ echo "# gin-web" >> README.md
$ git init
$ git add README.md
$ git commit -m "first commit"
$ git remote add origin https://github.com/AlexBruceLu/gin-web.git
$ git push -u origin master

本地已有的仓库添加到远程

$ git remote add origin https://github.com/AlexBruceLu/gin-web.git
$ git push -u origin master

git本地分支和远程分支改名

#1 将本地分支进行改名
$ git branch -m old_branch new_branch

#2 将远程分支的老分支删除
$ git push origin :old_branch

#3 将改名后的分支push到远程
$ git push origin new_branch

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件.

文章标题:git 新建仓库,添加远程分之到本地

文章字数:177

本文作者:AlexBruce Lu

发布时间:2019-12-09, 18:40:43

最后更新:2019-12-16, 19:44:41

原始链接:https://alexbrucelu.github.io/2019/12/09/git%E6%96%B0%E5%BB%BA%E4%BB%93%E5%BA%93/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏