Git 中级
George Boorman
Curriculum Manager, DataCamp


origin 远程获取git fetch origin
获取所有远程分支
若仅在 remote 存在,可能会创建新的本地分支
不会将远程内容合并到本地仓库
origin 远程的 main 分支获取git fetch origin main
From https://github.com/datacamp/project
* branch main -> FETCH_HEAD
origin 远程的默认分支(main)合并到当前本地分支git merge origin
Updating 9dcf4e5..887da2d
Fast-forward
tests/tests.py | 13 +++++++++++++
README.md | 10 ++++++++++
2 files changed, 23 insertions (+)
Git 为此提供便捷方法!
从远程默认分支(main)获取并合并到当前本地分支
git pull origin
origin 远程的 dev 分支拉取git pull origin dev
From https://github.com/datacamp/project
* branch dev -> FETCH_HEAD
Updating 9dcf4e5..887da2d
Fast-forward
tests/tests.py | 13 +++++++++++++
README.md | 10 ++++++++++
2 files changed, 23 insertions (+)
git pull origin
Updating 9dcf4e5..887da2d
error: Your local changes to the following files would be overwritten by merge:
README.md
Please commit your changes or stash them before you merge.
Aborting
remote 拉取前务必先保存本地更改Git 中级