mixu/gr

Conditionally execute based on current branch

Closed this issue · 1 comments

In large projects with many repositories there are times when you need to run commands on a certain set of repositories (facilitated by the tags functionally) but additionally only if that repository is on a specific branch.

In my current work flow I ended up with a branch that didn't have its upstream set. I had a tag for the current set of repositories, but one specific branch didn't have its upstream set. Through tags, I could add the tag to the repositories and then run my command, but at that point I could just run the command manually as I visit each repository.

In situations like these, it would be nice to have a way to filter by tag and by branch. It could look something similar to:

gr -t someTag -b someBranch -- git branch --set-upstream-to=origin/someBranch someBranch

@andrewpmartinez The workaround here may help you: #93