Is it possible to view multiple git branches at the same time for the same project?

James Raitsev picture James Raitsev · Sep 12, 2011 · Viewed 31.8k times · Source

I have 2 branches, which are not ready to be merged yet, but have some complementary logic, which I'd like to review (before merging)

Can I check out multiple git branches of the same project? Is it possible?

Answer

meagar picture meagar · Sep 12, 2011

You can simply copy the repository to a new location (either by literally copying the directory, or using git clone --shared) and check out one branch per location.

You can also use git-worktree for creating multiple working directories from a single instance of a repository.

Otherwise, the primary means for comparing files between branches prior to merging them is git diff.