tj / tj/git-extras

show-{merged,unmerged}-branches will ignore any branch name containing the default branch name

Open Beginner friendly
#1,271 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
18.1k
Forks
1.2k
Avg merge
5d 17h
Merged PRs (30d)
1

Description

The show-merged-branches and show-unmerged-branches scripts both pipe their output through a series of greps which include:

| grep -v "$(git_extra_default_branch)"

...Which will exclude any branch with a name that contains the default branch name, not merely matches it. For example, in this set of branches:

$ git branch --merged
  a-branch
+ an-other
+ main
  mainly-merged-code
+ remaining-work
  returned-to-main

If the default branch name is main, all of the last four branches would be hidden from a git show-merged-branches listing, not only main itself:

$ git show-merged-branches
a-branch
+an-other

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the show-merged-branches and show-unmerged-branches scripts and inspect the grep pipeline around git_extra_default_branch. Reproduce the example with branches containing and exactly matching the default branch name, then verify both listings retain containing names while excluding only the exact default branch.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, shell
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.