Some notes about remote repo in Git

Basic Concepts

  1. 不是当前 repo 的 都是 remote repo,既可以在网络上,又可以在同一台电脑上。

  2. remote branches 跟 local branches 相似,不过他们是另外一个 repo 的 branch。

  3. The git remote add 相当于添加了 另一个 repo 的书签,方便以后使用。

  4. fetch 和 push 几乎相反,因为 fetching imports branches,而 pushing exports branches to another repo.

  5. git push不能自动地 push 一个特定分支上的 tags,所以如果有必要,需要手动 push tags。

  6. git remote中列出的是 remote-names,他们起的是书签的作用,对应的是其他 repos的完整路径。

  7. remotes 是针对人的,而 branches是针对 topics 的. 不要为不同的开发人员创建不同的分支——这是项目开发的事情,而应该给他们单独的仓库,并用git remote add区别开来。

Quick Reference

git clone <remote-path>

Create a copy of a remote Git repository.

git remote

List remote repositories.

git remote add <remote-name> <remote-path>

Add a remote repository.

git fetch <remote-name>

Download remote branch information, but do not merge anything.

git merge <remote-name>/<branch-name>

Merge a remote branch into the checked-out branch.

git branch -r

List remote branches.

git push <remote-name> <branch-name>

Push a local branch to another repository.

git push <remote-name> <tag-name>

Push a tag to another repository.

References

Ry’s Git Tutorial By Ryan Hodson

本作品采用《CC 协议》,转载必须注明作者和本文链接
日拱一卒
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!
未填写
文章
93
粉丝
85
喜欢
153
收藏
121
排名:71
访问:11.4 万
私信
所有博文
社区赞助商