6 ms·
> If you want to check what it's difference between two branches, you can simply do: git diff branch1..branch2. This won't give you the difference between two
by masklinn 13y ago
> If you want to check what it's difference between two branches, you can simply do: git diff branch1..branch2.
This won't give you the difference between two branches, it will give you the commits in the second branch which are not in the first one (technically it will give you the commits accessible from the second revspec which are not reachable from the first one, they need not be branches).
This means you won't see things in branch1 which have changed since the branches split.
If you want to see the differences between the two branches, you need to use <rev1>...<rev2> (three dots)
In set-theoretic notation, the first one is `a(branch2) \ a(branch1)` while the second one is `a(branch1) △ a(branch 2)` (where a is the ancestors-and-self function)
> Most people just use git status, but you can pass arguments to change the way status is shown. With git status -sb you have an output like this:
> ## master
> M Gemfile
> M Gemfile.lock
> M app/controllers/home_controller.rb
> M app/views/home/index.html.erb
This is mixing 2 changes and missing important information:
-s will provide what most people are looking for here, that is an SVN-like "short status" with no prose or suggestion text. Because of the index, Git has 2 status flags, the index state (difference between repository and index) and the second one is the working copy state (difference between working copy and index). The flags also feature specific states for merging situations.
-b adds branch information to the short status format, as `local[...remote]` (with the remote being absent if the local branch has no configured upstream).
- dima55 13y agoHi. You appear to be too smart for your own good. "git diff A..B" is synonymous with "git diff A B" (i.e. just compare the two points in the tree without regard to their history). "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B" (i.e. ... does what you think .. does). The manpage is very clear about this.