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?

  • Lost work doing a git checkout, how can I get it back
  • Setting up DotBot & Antigen
  • Cannot get
  • What to include in gitignore for a Laravel and PHPStorm project?
  • GitLab + GitLab CI + Dependent SSH projects via NPM
  • Ignoring files already in a repo WITHOUT deleting them
  • git ignore vendor directory in Zend Framework 2
  • brew doctor Warning: How to add git to PATH?
  • Using git, how do I ignore a file in one branch but have it committed in another branch?
  • Branch/change not merged, though Gerrit claims, it is
  • Maintaining two code bases that are 90% the same installed on two different servers that must be isolated from each other?
  • How to find the path of the local git repository when I am possibly in a subdirectory
  • 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 view branch.

    The same logic applies with more than two branches, as the merge command accepts an arbitrary number of branches to merge.

    Git Baby is a git and github fan, let's start git clone.