repo for all except some projects not all. is there a repo command to do this?

spitfire88 picture spitfire88 · Feb 24, 2015 · Viewed 10.3k times · Source

I have tried googling this but havent found anything relavant to what im looking for. I have a few projects in android that i have rebased to the tip. After doing that I would like to move all the remaining projects to the tip.

The below command will checkout all the projects to the tag. repo forall -c "git checkout "

I would like to skip the ones that i have rebased manually.

Appreciate your help. Thanks!

Answer

Magnus Bäck picture Magnus Bäck · Feb 24, 2015

With repo forall you can specify which projects the command should apply to, but there's no way of expressing "all projects except these N projects" (unless you can express the projects you want it to apply to using a regular expression, but that's not likely).

What you can do is produce a list of all projects, e.g. with

repo forall -c 'echo $REPO_PROJECT'

and remove the projects you've rebased and want to exclude, e.g. by piping the output to grep -v or by redirecting the output to a file and editing that file by hand. Then feed that project list to repo forall. Two examples:

repo forall -c 'echo $REPO_PROJECT' > projects
vi projects
repo forall $(cat projects) -c 'git checkout'

repo forall $(repo forall -c 'echo $REPO_PROJECT' | grep -v name/of/project) -c 'git checkout'