Git Cheatsheet Part 3: Remote Repository

Git Cheatsheet Part 3: Remote Repository

Table of Contents

远程仓库

添加远程仓库

1
git remote add <remote-name> <remote-url>
查看远程仓库
1
git remote -v
删除远程仓库
1
git remote rm <remote-name>
重命名远程仓库
1
git remote rename <old-name> <new-name>
从远程仓库拉取代码
1
git pull <remote-name> <branch-name>
fetch默认远程仓库(origin)当前分支的代码,然后合并到本地分支
1
git pull
将本地改动的代码rebase到远程代码最新的代码上(为了有一个干净的线性的提交历史)
1
git pull --rebase
推送代码到远程仓库(然后再发起pull request)
1
git push <remote-name> <branch-name>
获取所有远程分支
1
git fetch <remote-name>
查看远程分支
1
git branch -r
fetch某一个特定的远程分支
1
git fetch <remote-name> <branch-name>

Git Cheatsheet Part 3: Remote Repository

https://jerry20000730.github.io/wiki/Git/git3/

Author

Tragic Master

Posted on

2023-10-13

Updated on

2023-10-13

Licensed under