学员信息
- 学号: 1901030012
- 学习内容: MIT第9课视频文稿p2
- 学习用时: 20mins Notes no.: Day41
学习笔记
git pull
is a convenient shortcut for completing both git fetch
and git merge
in the same command:
1 | $ git pull *remotename* *branchname* |
Because pull
performs a merge on the retrieved changes, you should ensure that your local work is committed before running the pull
command. If you run into a merge conflict you cannot resolve, or if you decide to quit the merge, you can use git merge -- abort
to take the branch back to where it was in before you pulled.
-
2.1 Open Terminal.
-
2.2 Change the current working directory to your local project.
-
2.3 Fetch the branches and their respective commits from the upstream repository. Commits to
master
will be stored in a local branch,upstream/master
.1
2
3
4
5
6
7$ git fetch upstream
> remote: Counting objects: 75, done.
> remote: Compressing objects: 100% (53/53), done.
> remote: Total 62 (delta 27), reused 44 (delta 9)
> Unpacking objects: 100% (62/62), done.
> From https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY
> * [new branch] master -> upstream/master -
2.4 Check out your fork’s local
master
branch.1
2$ git checkout master
> Switched to branch 'master' -
2.5 Merge the changes from
upstream/master
into your localmaster
branch. This brings your fork’smaster
branch into sync with the upstream repository, without losing your local changes.
1 | $ git merge upstream/master |
If your local branch didn’t have any unique commits, Git will instead perform a “fast-forward”:
1 | $ git merge upstream/master |
- 从Maestro给我们的参考资料入手,硬着头皮看了一遍,然后还是各种不知道该问什么问题。都不明白么?好像也不是。。。傻傻搞不明白这里面的具体操作,我就重新打字打一遍又看一次,well,好像没有那么陌生了,隐约觉得这个就是那天Maestro云淡风轻d秀肌肉使用的眼花缭乱的命令行技能???那我准备开始试着执行了哦。然后我就有第一个问题:
3.1 打开的Terminal是Mac的么?还是可以在VSCode里面的terminal里呢?
果然哦,我在Mac的Terminal里输入的时候不知道要怎么输入 remotename 和 branchname,因为在~
根目录下吧,所以报fatal: not a git repository (or any of the parent directories): .git
。然后我在VSCode里面,显示的是我本地已经clone下来的selfteaching-learning-notes.github.io文件目录,然后git pull
就居然就显示:
1 | cat at cattekimbp in ~/Documents/GitHub/selfteaching-learning-notes.github.io on source |
尝试在Mac的Terminal里输入我猜的 remotename 和 branchname,我觉得我.git
文件路径的问题么?是命名的问题么?我要去睡觉了,说不定我能梦到我在Google解。哈哈哈哈。加油,白天喝了咖啡再来玩。。。我觉得我似乎找到了一点儿玩
的赶脚了。吾厘Maestro 万岁!!!yeah!