Home > OS >  Git cherry-pick - How to display changes without actually doing anything
Git cherry-pick - How to display changes without actually doing anything

Time:11-10

Is there any way to display changes that would be applied by the 'git cherry-pick ' before actually doing anything?

I would like to see a 'git diff' type of list of changes that would be done by the command without actually doing the changes or modifying anything.

CodePudding user response:

git cherry-pick doesn't have a --dry-run option like some other commands.

However, although not exactly what you asked, you could just test it out, the rollback would be trivial :

# cherry-pick without actually committing
git cherry-pick -n <commit>

# inspect changes
git diff --staged

# wipe all these temporary changes to go back to where you started
git reset --hard

CodePudding user response:

I Believe you can do a git diff between the last commit on your branch and the commit you want to cherry-pick like so :

git diff [last-commit-hash] [cherry-pick-commit-hash]

  • Related