My Branches determines your branch contributions, lists them, and lets you delete outdated branches easily
After working using one branch per feature for a while any Git-repository typically becomes a mess of outdated and unfinished branches. To deal with this issue you need to clean up old and unused branches. My Branches determines your branch contributions, lists them, and lets you delete outdated branches easily.
At login the plugin scans all repositories for which you have at least read permission, determines the branches where your commits are among the most recent ones and displays the commit count in the branch icon (using git log --first-parent). Click on the icon to see a dialog containing a table showing your branch contributions.
For all branches you have delete permission, a delete checkbox is shown.
My Branches respects all project-, repo- and branch-permissions. If you have the ability to see or to remove a branch, then in My Branches you can do so as well.
My Branches doesn’t run on Windows, but in Cygwin and gitbash.
Default-branches and source-branches of open pull requests
The possibility to delete a branch depends not only on permissions: Default-branches and source-branches of open pull requests can’t also be deleted.
My Branches is an approach
Branches in Git are just pointers. They are no objects, they have no author, and they have no commits. Therefore, you cannot say "the commit abc is on branch b1". You can only say "if you look at branch (-ponter) b1, you can see commit abc". But you will see more than commit abc. You will see all commits in line with that commit until the first commit in that repository. My Branches looks at those branch pointers and checks the author of the most recent N commits, the default is 4. But the "branch" might be longer or shorter. If it is shorter, My Branches will take commits into account which are not "on that branch", but before that. Here some examples:
Alex works on feature/f1. In My Branches, he sees feature/f1 with commits 5, 6, 7 and 8.
--1-- master \ 2---3---4---5---6---7---8 feature/f1 A A A A A A A
Alex and Lea work on feature/f2. In MyBranches, both Alex and Lea see feature/f2 with commits 5, 6, 7 and 8.
--1-- master \ 2---3---4---5---6---7---8 feature/f2 L L A L A A L
Alex and Lea start working on feature/f4. Alex makes two commits 4 and Lea commit 5. After that he goes on vacation. In the meantime, Nick works on feature/f5 (7, 8, 9) and merges back his branch into master with commit 10. Before Alex comes back, Lea upates their branch feature/4 from master to participate on Nick's work. She commits the merge with commit 11.
N N N --1--2--3---------6----------10 master \ \ /\ \ 7---8---9 \ feature/f5 \ N N N \ 4---5----------------11 feature/f4 A L L
'git log' for feature/f4:
12da167 Lea #11 Merge branch 'master' into feature/f4 (HEAD -> feature/f4) 9f48a9d Nick #10 Merge branch 'feature/f5' into master (master) 468f9cb Nick #9 (f5) (feature/f5) c1ed28e Nick #8 (f5) 8235255 Nick #7 (f5) 39f3d23 Nick #6 (master) 26b4502 Alex #5 (f4) 4356de2 Alex #4 (f4) 9845ec6 Nick #3 (master) 82a742c Nick #2 (master) 49f7a00 Nick #1 (master)
Alex's commits are not within the most recent 4 ones!
But with rule 'follow first parent', he sees what he expects: Commits 3, 4, 5 and 11.
=> This is how My Branches works.
* 12da167 Lea #11 Merge branch 'master' into feature/f4 (HEAD -> feature/f4) |\ | * 9f48a9d Nick #10 Merge branch 'feature/f5' into master (master) | |\ | | * 468f9cb Nick #9 (f5) (feature/f5) | | * c1ed28e Nick #8 (f5) | | * 8235255 Nick #7 (f5) | |/ | * 39f3d23 Nick #6 (master) * | 26b4502 Alex #5 (f4) * | 4356de2 Alex #4 (f4) |/ * 9845ec6 Nick #3 (master) * 82a742c Nick #2 (master) * 49f7a00 Nick #1 (master)
Alex works on feature/f6 with commits 6 and 7, finishes his work and merges back his branch to master with commit 8. After that, Lea creates branch feature/f7 from master and implements her feature with commits 9, 10, 11. Lea uses My Branches and sees branch feature/f7 with commits 8, 9, 10 and 11. This is what she expects (at least she expects 9, 10 and 11). But Alex sees in his My Branches feature/f7, too! This is not what he expects. But he sees feature/f7 because of commit 8, and because of Git (and also My Branches) does not know where feature/f7 starts.
A --1--2--3--4--5-------8 master \ /\ 6---7 \ feature/f6 A A \ 9---10---11 feature/f7 L L L