Second revision:
git reset --soft HEAD^ (to undo your commit)
git stash (to stash away your changes)
git reset --soft HEAD^ (to undo the merge commit from X)
git stash (stash away X)
git stash apply stash@{1} (apply your changes)
git add . (add and commit and push ..)
git commit -m "some changes"
git push
git stash apply stash@{0}
Revised answer:
Ok, then you need to reset one step more back in the history:
git reset --soft HEAD^ (to undo your commit)
git stash (to stash away your changes)
git reset --hard HEAD^ (to undo the merge commit from X)
git stash apply (apply your changes)
git add . (add and commit and push ..)
git commit -m "some changes"
git push
git merge featureX (re merge the changes from X)
Original answer:
You could reset your head so your commit is moved to the index:
git reset --soft HEAD^
Now git will be in the state of the merged code and your changes uncommitted and ready to be staged again. Now you can stash these changes:
git stash save "stashing commit for changes from X"
Now you can push up the merged changes from X and after that apply the stash, add and commit:
git push
git stash apply
git add .
git commit -m "some stuff"