til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

Compare Two Branches and Get a List of Files

Comparing two branches (or even commits) might give your a lot of output, but you can tell Git to just give you a list of the files.

  • --name-only gives your only filenames
  • --name-status gives you filenames and status

Compare current branch with master and get filenames and statuses:

git diff --name-status master
A       git/compare_two_branches_and_get_a_list_of_files.md

Or comparing current branch with master and get only filenames:

git diff --name-only master
git/compare_two_branches_and_get_a_list_of_files.md

Compare two branches and get filenames and statuses:

git diff --name-status master another_branch
A       go/use_mage_build_tool.md

Compare two branches and get only filenames:

╰─ git diff --name-only master another_branch
go/use_mage_build_tool.md

Resources and References