Git: see many branches in a single view
Is there any way to see changes from many branches in Git in a single view. For example if my project consists of scripts part and C code part, can I have them on two separate branches but still see all changes in a single view?
One Solution collect form web for “Git: see many branches in a single view”
To create such a “view”, simply create a third branch and merge the branches you care about:
git checkout -b view branch1 git merge branch2 # now 'view' sees contents of both branches
view will only show the branch contents at the time of its creation. To update the view, simply add the new merged content:
git checkout view # switch to the view git merge branch1 branch2 # ...and merge the new branch contents
If the file names in the branches are disjoint, the merges should never have conflicts. If there are conflicts on common files (such as
README), they will be trivially resolved, and their resolution confined to (and remembered by) the
The same logic applies with more than two branches, as the
merge command accepts an arbitrary number of branches to merge.