如何检查远程(原始)Git存储库中的更改 [英] How to check for changes on remote (origin) Git repository
问题描述
执行以下工作流程的Git命令是什么?
What are the Git commands to do the following workflow?
场景
我从一个存储库中克隆并对本地存储库进行了一些自己的提交.同时,我的同事对远程存储库进行了提交.现在,我要:
I cloned from a repository and did some commits of my own to my local repository. In the meantime, my colleagues made commits to the remote repository. Now, I want to:
-
检查是否有任何新的 从其他人的承诺 远程存储库,即
origin
?
Check whether there are any new commits from other people on the remote repository, i.e.
origin
?
说在
自上次以来的远程存储库
拉,我想比较
远程存储库的提交,即
HEAD~3
与HEAD~2
,HEAD~2
与
HEAD~1
和HEAD~1
与HEAD
.
Say there were three new commits on the
remote repository since my last
pull, I would like to diff the
remote repository's commits, i.e.
HEAD~3
with HEAD~2
, HEAD~2
with
HEAD~1
and HEAD~1
with HEAD
.
了解远程更改后, 我想获取最新的提交 来自其他人.
After knowing what changed remotely, I want to get the latest commits from the others.
我到目前为止的发现
对于步骤2:我知道插入符号HEAD^
,HEAD^^
等和波浪号HEAD~2
,HEAD~3
等
For step 2: I know the caret notation HEAD^
, HEAD^^
etc. and the tilde notation HEAD~2
, HEAD~3
, etc.
对于第3步:我想只是一个git pull
.
For step 3: That is, I guess, just a git pull
.
推荐答案
您可以git fetch origin
更新存储库中的远程分支以指向最新版本.对于与遥控器的区别:
You could git fetch origin
to update the remote branch in your repository to point to the latest version. For a diff against the remote:
git diff origin/master
是的,您也可以使用插入符号.
Yes, you can use caret notation as well.
如果要接受远程更改:
git merge origin/master
这篇关于如何检查远程(原始)Git存储库中的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!