从Git Init的说起

在本地新建了一个git 目录后,往往需要run这样两条命令

1. git remote add origin (git repository的URL)例如https://github.com/Ray-Young/Test  【指定fetch信息】

origin是仓库名,我们来看git pro上的一段解释:

假设你们团队有个地址为 git.ourcompany.com 的 Git 服务器。如果你从这里克隆,Git 会自动为你将此远程仓库命名为 origin,并下载其中所有的数据,建立一个指向它的master 分支的指针,在本地命名为 origin/master,但你无法在本地更改其数据。

同理,如果已经在github上创建了Repository,Github会自动将这个仓库命名为origin

解析这条命令,git remote add 仓库名 仓库地址

2. git push -set-upstream origin master  【指定push信息】

这条命令是指定本地端更新到远端的地址,我们只能将相应内容push到origin仓库,但我们能够指定不同的分支(分知名必须与当前分支名相同)

Tips:

1. 删除远端分支 git push origin :分知名

2. git push命令解析:git push 【仓库名】 【本地分知名】:【远端分支名】

引用: [3.5 Git 分支 - 远程分支] 

https://git-scm.com/book/zh/v1/Git-%E5%88%86%E6%94%AF-%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF 

原文地址:https://www.cnblogs.com/Raymond-Yang/p/5160838.html