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

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

问题描述



什么是Git命令来执行以下工作流程?



场景



我从存储库中克隆并执行了自己的一些提交到本地存储库。同时,我的同事向远程存储库提交了提交。现在,我想:


  1. 检查$ b $上的其他人是否有任何新的
    提交b远程仓库,即 origin


  2. 假设
    有3个新的提交远程存储库,因为我上一次
    拉,我想用
    $远程存储库的提交,即
    HEAD〜3 $ c> HEAD〜2 , HEAD〜2 with
    HEAD〜1 HEAD〜1 HEAD


  3. <在知道什么是远程更改后,
    我想从其他人那里获得最新的

到目前为止我的发现



对于步骤2:我知道插入符号 HEAD ^ HEAD ^^ 等以及波浪符号 HEAD〜2 HEAD〜3 等。



对于第3步:也就是说,我猜,只是一个 git pull

解决方案

您可以 git fetc h origin 来更新存储库中的远程分支以指向最新版本。针对远程设备的差异:

  git diff origin / master 

是的,您也可以使用脱字符号表示法。



如果您想接受远程更改: / p>

  git merge origin / master 


Question

What are the Git commands to do the following workflow?

Scenario

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. Check whether there are any new commits from other people on the remote repository, i.e. origin?

  2. Say there were 3 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.

  3. After knowing what changed remotely, I want to get the latest commits from the others.

My findings so far

For step 2: I know the caret notation HEAD^, HEAD^^ etc. and the tilde notation HEAD~2, HEAD~3 etc.

For step 3: That is, I guess, just a git pull.

解决方案

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.

If you want to accept the remote changes:

git merge origin/master

这篇关于如何检查远程(原始)Git存储库上的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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