如何获取和rebase?

问题描述 投票:0回答:1

git pull is只是一个:

git pull命令实际上是两个其他命令的组合,git fetch后跟git merge

所以我可以手动执行两个命令:

# I'm on master branch now!

$ git fetch origin master

remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 5 (delta 4), reused 4 (delta 4), pack-reused 0
Unpacking objects: 100% (5/5), done.
From github.com:user/app
 * branch            master     -> FETCH_HEAD
   2b73030..58a1447  master     -> origin/master

$ git merge origin/master  // <= from 'origin/master'

如你所见,在第二个命令中,我将origin/master合并到master

但是如何用rebase做到这一点?我怀疑origin/master是否适合rebase

$ git fetch origin master
$ get rebase origin/master // <= is this correct? What is correct way?
git rebase
1个回答
3
投票

是的,这是完全正确的(虽然我只是git fetchgit fetch origin更新所有本地origin镜像,这也防止相当旧版本的Git问题)。

但是,你也可以简单地做git pull --rebase

© www.soinside.com 2019 - 2024. All rights reserved.