有没有一种快速的方法来“git diff”从点或分支的起源? [英] Is there a quick way to "git diff" from the point or branch origin?
问题描述
我已经看过使用 git diff
和git修订版(HEAD,ORIG_HEAD,FETCH_HEAD等)的各种SO答案,但我仍然没有找到简单的方法列出自从本地分支开始以来或自上次发生变更以来所做的更改。
通过 easy 我的意思是不必看并且粘贴提交SHA或必须计算我想回顾的提交数量。
git diff origin / master
很接近,但它指的是远程,因为我从它检出了新的分支,可能已经发生分歧。
我希望可以使用 git diff BASE_HEAD
。
...除非已经有办法做到这一点。有没有人有答案?
使用 有两个点,或者 有三个点,它只会显示你身边变化的差异。 I have looked at various SO answers on using By easy I mean without having to look up and paste commit SHA or having to count how many commits I want to look back. I would expect something like ...unless there's already a way to do that. Does anyone have the answer? Use With two dots, or with With three dots, it will only show diffs from changes on your side. Edit: for people with slightly different needs, you might be interested in 这篇关于有没有一种快速的方法来“git diff”从点或分支的起源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! git diff @ {u} ... HEAD <
HEAD
省略,它会显示
<编辑:对于需求略有不同的用户,你可能会对 git merge-base
感兴趣(注意它有比其他答案用途更多的选项)。 p> git diff
and git revisions (HEAD, ORIG_HEAD, FETCH_HEAD, etc.) and I still haven't found an easy way to list the changes have been made since the beginning of the local branch, or since last rebase.git diff origin/master
is close, but it refers to remote which may have diverged since I checked out new branch from it. git diff BASE_HEAD
to be available.git diff @{u}...HEAD
, with three dots.HEAD
omitted, it will show diffs from changes on both sides.git merge-base
(note that it has plenty more options than the other answer uses).