差异当前文件版本和以前的一个远程存储库 [英] Diff current file version and previous one remote repository

查看:140
本文介绍了差异当前文件版本和以前的一个远程存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何区分我的工作文件版本与远程存储库中的某个以前版本?

How do I diff my working file version vs. some previous version in the remote repository?

说,我今天抽出6-8次提交到本地复制,然后希望看到我的最新工作版本(给定文件)与最新的远程或任何其他版本之间的差异。

Say, I pull today, perform 6 - 8 commits to my local copy and then want to see the diff between my latest working version ( of a given file ) and the latest on the remote or any other version.

推荐答案

如果你在谈论远程分支,比如 origin / master ,您可以使用 ^ 来引用相对于分支的祖先提交,就像您可以与当地分支机构合作:

If you're talking about a remote branch, say, origin/master, you can use ~ and ^ to refer to ancestor commits relative to a branch the same way you can with local branches:

# what change was introduced to origin/master in the last 4 commits?
git diff origin/master origin/master~3

如果您想区分目前工作目录与 origin / master 中第五次提交的内容相关,您可以省略第一个参数:

If you want to diff your current working directory against the 5th most recent commit on origin/master, you would omit the first argument:

git diff origin/master~4

这篇关于差异当前文件版本和以前的一个远程存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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