Skip to content

Instantly share code, notes, and snippets.

@christophemarois
Created September 15, 2023 12:57
Show Gist options
  • Save christophemarois/0d0b8128695a20b8112488a73854911c to your computer and use it in GitHub Desktop.
Save christophemarois/0d0b8128695a20b8112488a73854911c to your computer and use it in GitHub Desktop.
List branch changes in git
# list changed files in a branch compared to its base branch
# usage: git_list_branch_changes [base_branch?] | xargs echo
function git_list_branch_changes {
local BASE_BRANCH="${1:-main}"
(git diff --diff-filter=MA --name-only $BASE_BRANCH... && git status --short --porcelain | awk '{print $2}') | sort -u
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment