1

I would like to be able to see a list of todos in a branch by doing git diff between that branch and my master branch. but If I merge commits from that branch then I'll need to remove those comments in master and commit again. Is there a way to do that in one command.

drawde83
  • 129
  • 2
  • 13
  • To merge a branch into `master`, is just join the latest commit from the branch into `master`. If you don't need changes about todo comments included, you can create a `temp` branch, then use `git rebas -i` to remove the commit about todo, then merge the new created branch `temp` into `master`. – Marina Liu May 17 '17 at 07:47

1 Answers1

0

Simply list (as in here) the branches which are not yet merged to master:

git branch --no-merged master | cut -c3- | while read branch; do
  git grep 'TODO' "$branch"
  # or
  git diff master..$branch | grep "^+.*TODO"
done

See git branch --no-merged.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250