查找当前版本和最后版本之间的差异?

本文翻译自:Finding diff between current and last version?

使用Git,您如何找到当前版本和最后一个版本之间的差异?

git diff last version:HEAD

#1楼

参考:https://stackoom.com/question/fYMX/查找当前版本和最后版本之间的差异


#2楼

You can do it this way too: 你也可以这样做:

Compare with the previous commit 与之前的提交相比

git diff --name-status HEAD~1..HEAD

Compare with the current and previous two commits 与当前和之前的两个提交进行比较

git diff --name-status HEAD~2..HEAD

#3楼

如果您添加了但尚未提交,请使用cached标志:

git diff --cached --color

#4楼

Difference between last but one commit and last commit (plus current state, if any): 最后一次提交和最后一次提交之间的区别(加上当前状态,如果有的话):

git diff HEAD~

or even (easier to type) 甚至(更容易打字)

git diff @~

where @ is the synonim for HEAD of current branch and ~ means "give me the parent of mentioned revision". 其中@是当前分支的HEAD的synonim, ~表示“给我提到的修订版的父级”。


#5楼

正如amalloy评论所指出的那样 ,如果用“当前版本和最后版本”表示最后一次提交和之前的提交,你可以简单地使用

git show

#6楼

Firstly, use " git log " to list the logs on the repo. 首先,使用“ git log ”列出repo上的日志。

Now, select the two commit-ids, pertanining to the two commits, you want to see the differences ( Example - Top most commit and some older commit [as per your expectation of current-version and some old version] ). 现在,选择两个commit-id,相关两个提交,你想看到差异( 例子 - 最顶层提交和一些较旧的提交[根据你对当前版本和一些旧版本的期望] )。

Next, use : 接下来,使用:

git diff <commit_id1> <commit_id2>

or 要么

git difftool <commit_id1> <commit_id2>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值