dylan-k
9/30/2013 - 9:58 PM

This is one way to work with a subset of files, within a Git Branch. See also: http://ask.metafilter.com/249100/Can-a-Git-Branch-Contain-O

This is one way to work with a subset of files, within a Git Branch. See also: http://ask.metafilter.com/249100/Can-a-Git-Branch-Contain-Only-a-Sub-Set-of-the-Repository#3617407

# (on master)
git checkout -b subset
git rm file1.txt file2.txt # (remove the files you don't want on this branch)
git commit -m 'removed some stuff'
git checkout master # (go back to master)
git merge --strategy ours subset # (record a merge from the subset branch, but make no actual changes to master)
git checkout subset
# (edit file3.txt)
git add file3.txt
git commit -m 'edited file3'
git checkout master # (back to master again)
git merge subset # (will merge the change to file3.txt but still not the deletions)