gitium
gitium copied to clipboard
Leaving the WordPress editor open can overwrite other people's commits
When someone pushes changes while someone's editor is open, he won't see them, so when he saves from the editor, the changes that the other person did will be lost.
I see three solutions to this:
- doing a
git pull --rebasewhen hitting the save button and then pushing the changes (any merge conflicts should be solved by keeping what's in the editor) - a better solution would be to constantly update the file in the editor with
git pull --rebase - the best solution would be to have a JavaScript file that constantly tries to see if you're behind and, if you are, it should ask you if you want to do a
git pull --rebaseand show the newer version
Following the discussions with you, the best solution for this is to implement the 'take over' feature from post editor. This feature appears when more than one editor is editing the same post.
This could be a great addition to the WP core -> "Take over" for theme/plugin editing.
However this doesn't solve the issue when somebody else pushes changes through SFTP and/or using Git commands and you overwrite that code.
Can be done using wp_set_post_lock 'take over' and heartbeat to check for external changes