frostming / legit

Git for Humans, Inspired by GitHub for Mac™.
https://frostming.github.io/legit
BSD 3-Clause "New" or "Revised" License
5.7k stars 218 forks source link

Allow wildcard matching for "branches" command #258

Closed grahamu closed 4 years ago

grahamu commented 4 years ago

This update adds branch name wildcard pattern matching to the "branches" command. The use case is when a repository has many active branches and you just want to see branches matching a particular naming pattern.

The branch name wildcard patterns follow Unix filename pattern matching standards (from documentation for fnmatch):

Pattern Meaning
* matches everything
\? matches any single character
[seq] matches any character in seq
[!seq] matches any character not in seq

For a literal match, wrap the meta-characters in brackets. For example, '[?]' matches the character '?'.

Examples

branches without wildcard:

$ git branches
   develop               (published)
*  gu-branches-wildcard  (published)
   master                (published)

branches with wildcard:

$ git branches gu*
*  gu-branches-wildcard  (published)
grahamu commented 4 years ago

@frostming thanks for your consideration of this improvement to legit!

grahamu commented 4 years ago

Thanks so much for the merge @frostming! I look forward to a new 1.1.0 legit package published on PyPi soon!