Search code examples
gitcommitgit-cherry-pick

Print list of "git cherry-pick"ed commits on local branch which are not yet pushed


After doing:

git cherry-pick -n <commit1>
git cherry-pick -n <commit2>
git cherry-pick -n <commit3>
git cherry-pick -n <commit4>

I want to print the list of cherry-picked commits. These commits have not been pushed yet on the current branch as I am using -n option. How to do that?

Please note that I know, SHA1 gets changed after cherry-picking, so the commits should be identified by commit-message IMO.


Solution

  • This is not possible. With the -n you tell cherry-pick to not create a commit, but to just apply the changes to the worktree. So now you have the changes of 4 commits in your worktree, but you cannot identify from which commits these changes come, except by examining your command history, in bash this would be history or to only show the cherry-pick commands history | grep cherry-pick.