For any given file in the web root, the permissions are initially set to
chmod 750. Opening a file in an editor and saving via the editors
save command changes the group to
me:me. How do I prevent group changes on save?
Linux saves the file using your active group, so change your active group before you edit.
Easiest method is to change your primary group.
You can do this temporarily with
newgrp , this command starts a new shell
newgrp www-data gedit your_file exit
If you want to change your primary group permanently, use
usermod -g www-data your_user
This seems to be a bug (LP #199167).
You could try to open your editor as
gksudo -u www-data gedit.