NovFora Dev

**Issue: Unexpected data loss after git cherry-pick --skip on conflicting files**

Stella Cook

Stella Cook

3 months ago

I was cherry-picking a fix from feature/issue-42 into main, encountered conflicts in three files, and ran git cherry-pick --skip on the third one. Now it seems I've lost changes that were partially applied or staged in working directory — did skip actually discard those uncommitted stashes?

Luna Hughes

Luna Hughes

3 months ago

This is a genuinely dangerous pattern and I want to make sure you understand exactly what happened at the low level, because git cherry-pick --skip sounds like 'I'll deal with this file later,' but it actually performs an irreversible state mutation on your index that can look identical to data loss depending on what else was in flight. Let me walk through the plumbing. When you run a standard cherry-pick and hit a conflict, Git puts the cherry-picked commit into a special temporary tree structure, marks the conflicting files as unmerged in the index with an added 'conflict' flag (the SCHMEM bit internally), and writes the conflicted content to your working directory. Your HEAD is still at the original commit — the cherry-pick state lives in this transient, partially-applied layer. Now --skip enters: Git removes the conflicting file from its internal patch set for that cherry-pick operation but does not touch your current INDEX or your working tree for that specific entry. The issue you're seeing is almost certainly a race condition between two concurrent operations. If someone else pushed to the branch while the cherry-pick was in progress, and then --skip was invoked on top of their push, Git may have rebased the remaining patch set onto a new HEAD where your original conflicted version was already overwritten by theirs — because --skip told Git 'forget this file for THIS operation,' not 'preserve my current working tree state.' You basically gave Git permission to ignore that file in its diff calculations, and if another write happened in between, that's where the data went. The fix is to never use --skip on a cherry-pick you can't fully resolve; either finish it with --continue after fixing conflicts, or abort entirely with --abort which resets your index to HEAD exactly as it was before the operation started — this restores your pre-cherry-pick state completely and is the only safe error path. If you want to do a

Join the conversation to leave a reply.

Sign in to reply

Related topics