Is it possible to somehow use wildcards when specifying branch names in “git merge”?
For example, if I have:
sbos@malta:~/tmp/texterra$ git branch -r
origin/HEAD -> origin/master
origin/master
origin/share/branch1
origin/share/branch2
origin/share/another-branch
Can I do:
git merge origin/share/*
to merge with branch1, branch2 and another-branch?
I don’t think you can use wildcards directly in that way, but you could use
git for-each-refto match branch names. For example, look at the output of:(That’s deliberately more than you need in the pattern, so that I could demonstrate that wildcards work. You could just do
refs/remotes/origin/share/instead.)So, as one command you could do:
… to do an octopus merge from all of those branches.
To be honest, though, I’m finding it hard to think of a situation where I wouldn’t much prefer to do:
… or perhaps if there are lots of branches: