Re: [git-users] To know the string in which branch

2013-02-21 Thread John McKown
As Larry Wall said "Tim Toady" (TMTOWTDI ), aka "There's More Than One Way
To Do It". Which ever makes more sense to the programmer / user. I do admit
to often using esoteric methods.


On Thu, Feb 21, 2013 at 1:49 PM, Dale R. Worley  wrote:

> > From: John McKown 
> >
> > git branch | awk '{print $NF;}' | xargs -l git grep "foo"
>
> Or (which is easier to generalize):
>
> for BRANCH in $( git branch | cut -c 3- ) ; do git grep "foo" $BRANCH ;
> done
>
> Dale
>
> --
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
This is a test of the Emergency Broadcast System. If this had been an
actual emergency, do you really think we'd stick around to tell you?

Maranatha! <><
John McKown

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] To know the string in which branch

2013-02-21 Thread Dale R. Worley
> From: John McKown 
> 
> git branch | awk '{print $NF;}' | xargs -l git grep "foo"

Or (which is easier to generalize):

for BRANCH in $( git branch | cut -c 3- ) ; do git grep "foo" $BRANCH ; done

Dale

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] To know the string in which branch

2013-02-21 Thread John McKown
git grep is the answer. Once for each branch name:

git grep "foo" master
git grep "foo" maint
git grep "foo" temp

Assuming that there are three branches called: master, maint, and temp.

If you want an "easier" (but not "simpler") way to scan all branches, then
on a UNIX system (I don't know Windows), you can do:

git branch | awk '{print $NF;}' | xargs -l git grep "foo"


git branch lists the names of all the branches. The "awk" writes out the
"last" column's value. This is basically because the current branch is
prefixed with a "* " which needs to be stripped out. the "xargs -l" (lower
case l, not the number 1) then invokes the command: git grep "foo"
appending the branch name after the "foo". Each output line looks something
like:

branch_name:file_name:contents of matching line



On Thu, Feb 21, 2013 at 7:49 AM, Dale R. Worley  wrote:

> > From: William Seiti Mizuta 
> >
> > You can use "git grep string branch" to check if the string exists in the
> > branch.
>
> I think the question is, "How do you determine which branch contains a
> file that contains ?"
>
> Dale
>

-- 
This is a test of the Emergency Broadcast System. If this had been an
actual emergency, do you really think we'd stick around to tell you?

Maranatha! <><
John McKown

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] To know the string in which branch

2013-02-21 Thread Dale R. Worley
> From: William Seiti Mizuta 
> 
> You can use "git grep string branch" to check if the string exists in the
> branch.

I think the question is, "How do you determine which branch contains a
file that contains ?"

Dale

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] To know the string in which branch

2013-02-21 Thread William Seiti Mizuta
You can use "git grep string branch" to check if the string exists in the
branch.


William Seiti Mizuta
@williammizuta
Caelum | Ensino e Inovação
www.caelum.com.br


On Thu, Feb 21, 2013 at 4:35 AM, lei yang  wrote:

> Hi expert,
>
> Is there a git command to know string "foo" contains in which branch?
>
> Lei
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[git-users] To know the string in which branch

2013-02-20 Thread lei yang
Hi expert,

Is there a git command to know string "foo" contains in which branch?

Lei

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.