Given a number of branches, I'd like a file hierarchy that I could browse in my IDE that would show the files and folders that are associated with the branch.
There are probably some tricks and gotchas that I have to figure out, for example, is it possible to show files that have been edited within a branch, but to exclude merges of other branches?
Root Directory Structure (based on branches')
[branch]
[branch2]
[branch3]
`--[all] (symlinks to all files in one bucket)
`--[PATH\SYMLINK] (directory path + symlink)
`--[PATH\SYMLINK]
Notes:
Git: How do I list only local branches?
git for-each-ref --format='%(refname:short)' refs/heads/
Script in progress
#!/bin/bash
BRANCHDIR='/path/to/where/symlinks/go'
MASTER='master'
CODEDIR='/path/to/sourcecode'
OLDPATH=`pwd`
BRANCHDIRS=`git for-each-ref --format='%(refname:short)' refs/heads/ | xargs echo`
for i in $BRANCHDIRS;
do
BRANCHFILES=`git diff --name-only $i $MASTER`
mkdir -p $BRANCHDIR/$i $BRANCHDIR/$i/all
for j in $BRANCHFILES;
do
mkdir -p $BRANCHDIR/$i/$(dirname $j)
ln -s $CODEDIR/$j $(basename $j) -t $BRANCHDIR/$i/$(dirname $j)
ln -s $CODEDIR/$j $(basename $j) -t $BRANCHDIR/$i/all/$(basename $j)
done
done
cd $OLDPATH