Search code examples
bashgitfilterversioncherry-pick

How can I filter `git cherry` output?


I ran the below command,

git cherry main dev

The output for above command is like,

+ d86f3e25f42b546af008b774c2649d585cc48310
- 1d90a12b91b461f857eb373d69372a2864b9e651
+ 4194aa6d206225242e881d2128e59981b8826eeb

I want to see only commits which are not yet cherry-picked. i.e. (+ signed sha only).

Expected output,

+ d86f3e25f42b546af008b774c2649d585cc48310
+ 4194aa6d206225242e881d2128e59981b8826eeb

How can I do so?


Solution

  • This will do it :

    git cherry main dev | grep '^+'
    

    Regards!