Finding Everything That Has Changed in a Git Branch
December 21, 2021 Leave a comment
The following is shamelessly stolen from this StackOverflow post. Go there for more information, as well as some alternatives.
To get the list of files modified (and committed!) in the current branch you can use the shortest console command using standard git:
git diff --name-only master...
- If your local “master” branch is outdated (behind the remote), add a remote name (assuming it is “origin”):
git diff --name-only origin/master...
- If you want to include uncommitted changes as well, remove the
...
:git diff --name-only master
- If you use different main branch name (eg: “main”), substitute it:
git diff --name-only main...
- If your want to output to stdout (so its copyable):
git diff --name-only master... | cat
- If your want filenames to be clickable in VSCode terminal no matter what folder you are running this command from, add
--relative
:git diff --name-only --relative master... | cat