Show all commits for one branch when doing code review

Answered

HI:

I trying to do a code review, and the person who created a PR has all his commits in a feature branch. When i switch to the git tab view, (set branch to feature branch, and set user to the developer). But it looks the webstorm did a "or" logic, so it pick feature branch and also other branch the person has worked on as well.

So is there a way to show the single person's commits in the feature branch to do the code review ?

5 comments
Comment actions Permalink

HI Julia Beliaeva, thanks for the explanation. I get the the ideas about two dots range notation.  But the two dots range still give me complex git flow diagram as it try to reach out to find all the reachable branch.  Let me give you a real example, you will understand what i try to achieve.

Let say we have a main branch. 

1 Developer A created a feature branch A from main branch and work on it. 

2 Developer B created a feature branch B from main branch and work on it.

3 Developer A finished work and merged feature branch A back main branch.

.. it could be other developer create more features and merging merge at the same time as well.

4 Now, Developer B finished work, and fetch the latest main branch, merged main branch to the feature branch B. And developer B create a PR for me to review. 

If i select main..feature/B, i will get all the all the change in that branch as well all the reachable commits. Because developer B did a merge commit, it now show the all other origin/feature/branches(from git graph flow) from the remote master as well which is the thing i dont want. if you look the screenshot down below from another git gui call sourceTree.  if i select the top level set to "First Parent only", it will show that "merge" commit as a single dot rather than show all the relative things from upstream which does not interest to me. So i can focus on what is the actual code change that person has done in this branch, rather than seem upstream changes from other feature branch. Does this make senses to you ?

Further question:

1 how do i disable the origin/feature/ tag ?

2 is possible to have main theme darcula as coding them but set the git tool window to white background ? i found the git flow colour are really hard to see in the dark background. 

1
Comment actions Permalink

Zhewu1228, branch filter shows all commits belonging to the branch (meaning, commits which are reachable from the branch head). This behaviour is the same as with the command-line git. However, if you want to do a code review, you may want to see only commits from the feature branch and not from the main development branch. You can do that by using two-dot range notation (see https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-Theememtwo-dotRangeNotation). For example, to show commits in the `feature` branch but not in the `master` branch, you can enter `master..feature` expression in the branch filter.

It's unclear what is going on on the screenshot, as I see a filter by branch which name starts with `feature...`, however there are two branches with names starting with "feature". If you are filtering by the "top" one (with new commits), then the behaviour on the screenshot is correct: all of the displayed commits belong to that branch (as far as I see, `origin/release/...` branch was merged into it at some point). If the filter uses the other `feature...` branch, then it might be a bug.

0
Comment actions Permalink

Hi, Zhewu1228. Thank you for your reply. I tried to recreate the situation you are describing to see if I understand correctly what you are talking about.

1. Consider this repository. Developer A is working in branch `featureA`, developer B is working in `featureB`:

2. Now developer A is finished and merged his branch into `main`:

3.Then developer B merged `main` into `featureB`:

Let's try to review `featureB` now. We'd like to review two commits: "change by B #1" and "change by B #2". Let's set the two-dot filter (other filters are empty):

The two-dot filter shows two commits for review plus a merge commit. Commits from the `main` branch are not shown (including all commits in the `featureA` branch). It seems like for this example, the two-dot filter helps with the review.

If i select main..feature/B, i will get all the all the change in that branch as well all the reachable commits. Because developer B did a merge commit, it now show the all other origin/feature/branches(from git graph flow) from the remote master as well which is the thing i dont want.

This is not how this filter should work. If `main..feature/B` is selected then all commits from `main` are going to be hidden. If someone merged their feature branch into `main`, commits in this branch are going to be hidden. It works the same for remote branches, just write `origin/main..feature/B`, and also commit hashes instead of branch names work too. For example, for the screenshots in your last comments you can try this filter: `3066703..f7785e0`. Here I just used hashes off the second parent of the merge commit and feature branch head.

However, perhaps your real example is more complicated? Or, maybe, there is an unaccounted bug in this feature. Could you share more screenshots that demonstrate the problem with the dot-filter?

As for "first parent only" feature: we currently do not have this. You can vote for the ticket here: https://youtrack.jetbrains.com/issue/IDEA-127140

how do i disable the origin/feature/ tag ?

This is currently not possible. If a commit is shown, references on this commit are shown as well.

is possible to have main theme darcula as coding them but set the git tool window to white background ? i found the git flow colour are really hard to see in the dark background. 

It is possible to change the theme of the ide separately from the editor, but not specifically for git tool window. You can try switching the theme to the light one in the "Settings" -> "Appearance & Behavior" -> "Appearance", and then reverting editor theme to the dark one in the "Settings" -> "Editor" -> "Color Scheme". It will prompt you to change ide theme again, but can just choose not to. For me it looks like this:

Are you talking about color of the graph (nodes, edges) or some other colors?

0
Comment actions Permalink

HI Julia Beliaeva, Thanks,really appreciated the time you have spent and the effect you put in. The example you have created is exactly what i really want to achieve. if you look the screenshot down below (after i used the two dot notation), the merge commit "7bbcc393" actual link to the 'Integration branch" (our develop branch). So i dont know if it is bug or because we have quite few ppl working on the same project ,merge stuff in to the Integration branch etc to case this issue. But if i use the show "first parent only' option from sourceTree, it will works as expect, so i hope should feature can be added to webstorm in the future. 

And i have few comments. 

1 I personally feel that it was quite difficulty to operate this two dot filtering. The webstorm by default will show all the branch (both local and remote). so if i check out the branch that i want to review(see the second see shot), git flow graph will still showing all the developer commits  happening at the same time (including my local commits). Then i have set the user to the developer that i want to review the changes, then select the correct hash commit to apply two dot filtering.

This was steps i have to do in order to do the code review, to me this too verbose. After select a particular branch, it should have a button or icon on the bar let me do this filter easier or do it automatically.  The two dot syntax could be a build-in functionality rather than a user manually type in.

2 Thanks show me how to set different colour for editor and webstorm theme. But i want to set git tool window or more specifically the git flow and "Show Diff" window. The reason is the git flow colour (commit dot, flow) is not really stand out in the dark background. And when we are working in a large team, it really hard to see the flow for you own branch. i  can't even tell which colour is for develop branch. if you the screenshot down below,(from vs code). The blue is the colour for main branch or the branch i am current in. The colour is more brighter. Easier to follow. 

Same goes to the "show diff" tab,(see last screen shot). it Really hard to see what is actually the difference. 

Does webstorm plan to work on this to make colour more stand out ?

 

 

 

 

vscode:

 

"Show Diff"

 

0
Comment actions Permalink

Hi, Zhewu1228, thank you very much for your feedback. We are definitely going to improve two-dot-filter usability.

As for the colours:

1. You can try to select a theme which is more contrast at "Preferences | Appearance & Behavior | Appearance". Apart from the preinstalled themes it's possible to download third-party themes directly from the ide ("Get more themes" link in the "Appearance" page) or from https://plugins.jetbrains.com/search?tags=Theme.

2. It's possible to customise editor colours in the ide. For example, changing diff colours could be done in "Preferences | Editor | Color Scheme | Diff & Merge".

3. Unfortunately, colours of the graph are currently not adjustable. There is a plan to change it though.

0

Please sign in to leave a comment.