sourcegit icon indicating copy to clipboard operation
sourcegit copied to clipboard

Add ability to soloing selected branches

Open Mingun opened this issue 4 months ago • 20 comments

GitKraken has a useful feature in some scenarios: hide all other branches from the commit graph except the selected. This is named soloing. Unlike simply hiding branches, canceling solo is done with the one click. Thus, you can quickly temporarily turn off other branches, and after completion of the work, turn on everything that was previously visible back (and not turn on what was not visible).

In addition, you may append branches to the existing "solo" list.

Mingun avatar Aug 06 '25 11:08 Mingun

What specifically is the difference from SourceGit's Filter in commit graph?

after completion of the work, turn on everything that was previously visible back (and not turn on what was not visible)

Is turning back on only branches that were previously visible the main point?

Doodeletion avatar Aug 07 '25 00:08 Doodeletion

I want a mode that only displays the commits associated with the current head/branch, and is different from the highlight branch and filter modes.

  1. In highlight mode, it only highlights the current node and its parent.
    a. Its children are not highlighted.
    b. All other branches, commits, and decorated nodes interfere.
  2. Branch filtering is cumbersome. a. It requires careful selection of the branch, but I simply want to select the current branch without thinking.
    b. It only displays the parent, not the children. I would like to be able to view the parts associated with its children.

heartacker avatar Aug 07 '25 02:08 heartacker

step 1:

# git branch --contains <commithash>,
# e.g.
git branch --contains HEAD

# convert to filter
git branch --contains HEAD | sed 's/^[ *\+]*//' | tr '\n' ' '

step 2:

show those branches in a graph format:

git log `git branch --contains HEAD | sed 's/^[ *\+]*//' | tr '\n' ' '` --oneline --graph --decorate

heartacker avatar Aug 07 '25 03:08 heartacker

FocusCommit Mockup

https://github.com/user-attachments/assets/308721a7-4882-4be9-8526-78f1fcdf414f

heartacker avatar Aug 07 '25 07:08 heartacker

https://github.com/user-attachments/assets/2d2bfab3-c8a4-417b-8a19-91db561fcd08

heartacker avatar Aug 07 '25 12:08 heartacker

Introducing the whole new solo mode Now:

Based the commit(s), the Solo mode will show the commit and its contians decorators(branchs/tags/etc.), make you focus on your work , Eliminate other interferences

solo Head just on click

a. This will add HEAD and current_HEAD_sha to filter, current_HEAD_sha IT will be usefull if HEAD is changed in future

solo commit

You can select commit and add this commit to solo-commit filter

solo Commits

You can select multi commits and add those commits to solo-commit filter. That is great to focus/compare branch/tag/etc

navigate

Fantastically, you can navigate the branch/tag/commit filter in graph view now.

https://github.com/user-attachments/assets/aa5a8b2a-20a4-48cc-a634-b281646fa478

heartacker avatar Aug 08 '25 02:08 heartacker

Tip: it is hard to understand whats happening on the video. I think, the better would be to show 2 screenshots: one baseline and one with the solo enabled for the commit / branch / whatever (and describe, for what thing it was enabled). For example, I expect, if you solo the origin/develop branch (the HEAD commit of this branch) from the video preview pic, then only commits, corresponds to this branch is shown, so if you select commit in the graph, you may navigate to commits in this branch by just up/down arrows.

Mingun avatar Aug 08 '25 06:08 Mingun

What is Solo Mode?

Solo Mode designed to streamline the view of commit histories by focusing on specific commits and their direct associations.

When enabled, users can select one or more commits as filters. The tool then displays only the elements directly linked to these chosen commits, including:

  • Local branches that contain the commits
  • Related remote branches (such as those not yet merged into the local repository)
  • Tags attached to the commits

By hiding unrelated branches, tags, or commits, Solo Mode reduces visual clutter, allowing users to concentrate on analyzing the connections, origins, or merge status of the specific commits they care about.

For example, if you filter by the commit pointed to by HEAD, Solo Mode will show only your current branch, its associated remote branches, and any tags on that commit—making it easier to focus on relevant details without distractions.

heartacker avatar Aug 08 '25 07:08 heartacker

Image

heartacker avatar Aug 08 '25 07:08 heartacker

navigate just a function that could navigate the filters including the branch-filter and tags-filter and also the commit_hash(solo) filter

heartacker avatar Aug 08 '25 07:08 heartacker

is it clear

heartacker avatar Aug 08 '25 07:08 heartacker

With screenshots, the explanations are much clearer 👍

I correctly understand, that if I solo branch name, then this will persist even when branch is updated? In other words, the solo will be associated with a branch ref and not with the commit of the branch HEAD when solo was enabled?

Mingun avatar Aug 08 '25 07:08 Mingun

Also, will this mode be saved across sessions (i. e. after close / open the application)?

Mingun avatar Aug 08 '25 07:08 Mingun

First

  1. Solo mode is base Commit, if the commit_filter is kept on, and the branch/commits/tag/remote related to this commit is always shown. a. BTW the HEAD FILTER, it will always show the current HEAD in Sole mode, if you are change the HEAD like changing the branch and so on b. If you use sgit to checkout the new branch, sgit will clear the filter and add the new branch-filter, the commit-filter will be removed(This is the mechanism of sgit and I have no control over it)
  2. The filter is saved across sessions (this is the sgit feature, the filter feature)

heartacker avatar Aug 08 '25 07:08 heartacker

  1. branch-filter only should its local and remote(default, you can remove this)
  2. commit-filter always shows related commit/branch/tags/etc(all including ahead and behind )

heartacker avatar Aug 08 '25 08:08 heartacker

I find that:

if we have HEAD filter, it's no necessary to clear and add new-branch filter anymore

HEAD FILTER will follow the branch-head

heartacker avatar Aug 08 '25 08:08 heartacker

这种模式对多分支并行的项目实在是太有用了 🔥 This mode is really useful for projects with multiple parallel branches.

https://github.com/user-attachments/assets/40e78920-c843-421c-93d2-c2bb88985202

heartacker avatar Aug 09 '25 04:08 heartacker

在版本对比中,使用Solo 模式,并配合提交已选记忆,非常方便 👯 In version comparison, using Solo mode Cooperating with PR:selected-commits-memories is very convenient.

https://github.com/user-attachments/assets/a1d9ab41-7624-499f-8dd0-e850d86f60f3

heartacker avatar Aug 09 '25 04:08 heartacker

I'm trying out a method to highlight the route. How do you all think

https://github.com/user-attachments/assets/a30d73a5-9650-462f-9639-1de9c12dcaa5

heartacker avatar Aug 26 '25 08:08 heartacker

From the video it is not obvious, what condition is used for making line bold. When you at commit H or master, only line H--origin/master is bold, but when you at Fix large TextBox not wrapping, the origin/outlines -- ..., H--origin/master and a small loop with Fix large TextBox not wrapping is bold.

It seems, basically, all lines that starts in the graph after (upper) the selected commit are bold + some "main" line. But how the "main" line is determined?

Mingun avatar Aug 26 '25 09:08 Mingun