git pull --force的行为

时间:2017-01-10 21:26:04

标签: git

我的本​​地主分支是在origin / master

之前的两个提交

我想保留这两个提交并将本地主服务器与源同步。总的来说,具体来说,这些命令将会起什么作用?

git checkout -b "branch-to-save-my-two-commits"
git pull origin master --force

1 个答案:

答案 0 :(得分:-1)

我将两条线分开解释:

git checkout -b "branch-to-save-my-two-commits": 这将导致具有该名称的git move the working directory to a branch。它不会承诺,你必须自己做。

git pull origin master --force:会强制从主人那里拉(就像它听起来一样)。我认为,它会覆盖实际主人的所有本地更改,并将其转到原始主人的内容。

见官方git pull documentation