Here's a complete working solution with an example keybinding for spacemacs.
The master branch is hard-coded in as the default branch to compare for file
changes against. If you want to diff against the nearest parent branch you
would need something like this from https://stackoverflow.com/questions/10641361
git diff --name-only <notMainDev> $(git merge-base <notMainDev> <mainDev>)
Emacs Code. This is mostly a simplification of helm-projectile-find-files
and the resulting calls into projectile-current-project-files
and projectile-dir-files
(defun my:helm-projectile-changed-master ()
"Finds files changed from master in the current project."
(interactive)
(let ((changed-files (my:project-files-changed-from-master)))
(if changed-files
(helm :sources (helm-projectile-build-dwim-source changed-files)
:buffer "*helm projectile*"
:prompt (projectile-prepend-project-name "Find file: "))
(message "No files have changed from master."))))
(defun my:project-files-changed-from-master ()
"Returns a list of files changed from master in the current project."
(cl-mapcan
#'my:get-files-changed-from-master-in-dir
(projectile-get-project-directories)))
(defun my:get-files-changed-from-master-in-dir (directory)
"Returns list of files changed from master branch in DIRECTORY."
(let* ((root (projectile-project-root))
(default-directory directory)
(command "git diff --name-only master")
(changed-files (split-string
(projectile-shell-command-to-string command)
"\n"))
(changed-files-no-empty (delete "" changed-files))
(get-relative-project-file-name
(lambda (file)
(file-relative-name (expand-file-name file directory)
root))))
(projectile-adjust-files
(mapcar get-relative-project-file-name
changed-files-no-empty))))
(spacemacs/set-leader-keys "pj" #'my:helm-projectile-changed-master)