1

I tried this:

git branch -r --merged | grep '^origin/'

But I get nothing...

When I remove the caret:

  ✗ git branch -r --merged | grep 'origin/'
    origin/HEAD -> origin/master
    origin/master

I would like to make the regexp only match origin if the string begins with origin.

1 Answer 1

2

The output does not begin with origin, it begins with whitespace, so you need:

git branch -r --merged | grep -E '^[ ]+origin/'

(Although, of course, in your second example, all lines would match.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .