如何检查远程(原始)Git存储库中的更改 [英] How to check for changes on remote (origin) Git repository

查看:95
本文介绍了如何检查远程(原始)Git存储库中的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行以下工作流程的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:

  1. 检查是否有任何新的 从其他人的承诺 远程存储库,即origin?

  1. Check whether there are any new commits from other people on the remote repository, i.e. origin?

说在 自上次以来的远程存储库 拉,我想比较 远程存储库的提交,即 HEAD~3HEAD~2HEAD~2HEAD~1HEAD~1HEAD.

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~2HEAD~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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆