-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diff between branches #255
Comments
I have a workaround for you: Let's say you wanted to diff the branches
Now you can visually see just the changes in both branches and easily diff the two since one is at the top of the list. (Shamelessly copied & modified from myself here) |
Thanks, that a great workaround, very similar to my proposed alternative. I still think the command works be useful and simpler. |
It may sound silly, but I've spent 30 minutes trying to find a "Diff" or "Compare" command in the command palette, right clicking on commits in every combination possible, trying every search pattern I could think of. (I'm adding details for others coming here after looking up "sublime merge diff branches") I didn't realize that selecting 2 commits (
The workaround effectively solves the problem, although a command could be useful. I would see the implementation working as follow: (just an idea)
|
Maybe I'm missing something, but if the branches are "far apart" with many commits in between, then I can't see the tip of both in the display. So I can't click on the tips of both. That is, I only see the one branch, the other is not visible at all, even though both are marked visible. So I can't see how to diff the two branches in this case. To me this means you can't diff 2 branches in a lot of cases. The sublime merge diff view is so nice, I really wish it had a way to easily diff 2 branches. |
@pwinston, let me explain a bit more the logic behind my comment: My instructions include hiding every branch (, tag, stash, etc) except the two you want to diff. This was chosen to kind of cheat within the design of the user interface to force one of the two branches (the one with the newest commit) to be at the very top of the commit list/tree. Due to this behavior, you can select the older branch (not the top branch) from the location bar & then scroll to the top of the list via a scrollwheel or dragging the scrollbar & then It's entirely a cheat around the user interface until a command is created or plugin support is added. |
@srbs Wow thanks for your patience in explaining that. It works! I was correctly showing just the 2 branches. But I was scrolling down and visually looking for the tip of the older one, and it didn't seem to be there. Seemed like history ended before the older branch, although maybe I was just not looking carefully enough. But clicking on the older branch in the Locations pane takes you right there. And then click on the newer one. Great! |
@pwinston, not a problem and glad I could help! |
Here's another trick, using the
Here it is on the (massive) v8 codebase. It performs well: |
I'm currently trying to sum up the changes of my feature branch and cannot use this feature. There are changes that don't show up when I select all the commits that I did. In my branch I have reverted many changes in later commits, but some of these reverts don't show up either Steps to reproduce:
I would expect that selecting the two last commits together would show changes, but instead it shows only the removal of that text. Client Version is 1119 from stable branch |
@apothecarius, that is the correct behavior. Let me take a stab at explaining: Let's name the commits A, B, & C. These are the diffs you would see in the UI if you selected a single commit: However, when you select two commits in Sublime Merge, other git tools, or run Commit contents: If B & C are selected, the differences between the two commits are just 5 lines removed. If A & B are selected, the differences are just 5 lines added. You'll note that these two selections are identical to the B & C in the diffs above. If you want the changes of two diffs combined, you'll need to compare A & C. in this example. |
@srbs thank you for clarifying |
Is a |
+1 for a diff command to show the actual commit differences between two branches. |
I just purchased a license and was wondering if I made the right decision when I was not able to diff two branches. The workaround here #255 (comment) works for me but it I would also reiterate that there should be an easier and obvious way of doing this. Thanks. |
Note that you really don't need all possible steps listed in said comment (e.g. showing only the branches you want to compare is a bit of waste of time and/or definitely not always needed). At least 99% of the time I just click a commit, scroll if needed, Ctrl-click the other commit. |
I would like to put a +1 here for diffing two branches directly without resorting to the workarounds here. I'm in the middle of some work, and I want to essentially get a PR view between branches. If I hide all branches but those I'm interested in, I get a view that is a reverse of the PR currently. All in all it's so frustrating to try and get sublime merge to show me what I want, that it was quicker to just open some pointless PRs in our repo manager instead. |
This is a major omission. If I can I've tried all manner of Cmd+click combinations between commits and branches as suggested in various threads, without success. For now, I'm sticking with creating disposable PR's in Bitbucket to do what should be a simple local command. |
I actually came to this branch due to the problem described by @photex. It took me a while to realise after seeing a "reverse diff" between feature and main branch tips that I needed to select all commits in the feature branch from the branch point to the feature branch tip to see the "PR" diff. |
This should have been here from day 1, or close to it. I don't want to have to go to Github to see a complete diff between branches. This request getting on to being about 4 years old now too. |
I am in an organization where it's common to merge back the master branch onto the feature branch. The current diff feature of sublime merge where you have to ctrl+click on two commits to get the aggregated diff is often useless in that case because it will include all changes merged back to the feature branch... Please add a real diff between branches feature |
Problem description
Depending on the project, the commit tree can get very long and it can be difficult to find the last commit of a branch. This makes it difficult to compare the current branch to another branch
Preferred solution
A new command "Diff with another Branch". This command would list the available branches, just like "Checkout Branch". When the branch is selected, the app would display a diff between the HEAD of the current branch with the HEAD of the selected branch
Alternatives
A way to filter the commit list so that selecting two far apart commits easier.
The text was updated successfully, but these errors were encountered: