|
| 1 | + $ export TESTTMP=${PWD} |
| 2 | + |
| 3 | + $ cd ${TESTTMP} |
| 4 | + $ git init real_repo 1> /dev/null |
| 5 | + $ cd real_repo |
| 6 | + |
| 7 | + $ mkdir sub1 |
| 8 | + $ echo contents1 > sub1/file1 |
| 9 | + $ git add sub1 |
| 10 | + $ git commit -m "add file1" 1> /dev/null |
| 11 | + |
| 12 | + $ mkdir sub2 |
| 13 | + $ echo contents1 > sub2/file2 |
| 14 | + $ git add sub2 |
| 15 | + $ git commit -m "add file2" 1> /dev/null |
| 16 | + |
| 17 | + $ josh-filter -s :exclude[:/sub2] master --update refs/heads/hidden |
| 18 | + [1] :exclude[:/sub2] |
| 19 | + [2] :/sub2 |
| 20 | + $ git checkout hidden 1> /dev/null |
| 21 | + Switched to branch 'hidden' |
| 22 | + $ tree |
| 23 | + . |
| 24 | + `-- sub1 |
| 25 | + `-- file1 |
| 26 | + |
| 27 | + 1 directory, 1 file |
| 28 | + $ git log --graph --pretty=%s |
| 29 | + * add file1 |
| 30 | + |
| 31 | + $ echo contents3 > sub1/file3 |
| 32 | + $ git add sub1/file3 |
| 33 | + $ git commit -m "add sub1/file3" 1> /dev/null |
| 34 | + |
| 35 | + $ josh-filter -s :exclude[:/sub1,:/sub2] master --update refs/josh/filtered |
| 36 | + [1] :/sub1 |
| 37 | + [1] :exclude[ |
| 38 | + :/sub1 |
| 39 | + :/sub2 |
| 40 | + ] |
| 41 | + [1] :exclude[:/sub2] |
| 42 | + [2] :/sub2 |
| 43 | + [2] :[ |
| 44 | + :/sub1 |
| 45 | + :/sub2 |
| 46 | + ] |
| 47 | + |
| 48 | + $ git checkout refs/josh/filtered |
| 49 | + Note: switching to 'refs/josh/filtered'. |
| 50 | + |
| 51 | + You are in 'detached HEAD' state. You can look around, make experimental |
| 52 | + changes and commit them, and you can discard any commits you make in this |
| 53 | + state without impacting any branches by switching back to a branch. |
| 54 | + |
| 55 | + If you want to create a new branch to retain commits you create, you may |
| 56 | + do so (now or later) by using -c with the switch command. Example: |
| 57 | + |
| 58 | + git switch -c <new-branch-name> |
| 59 | + |
| 60 | + Or undo this operation with: |
| 61 | + |
| 62 | + git switch - |
| 63 | + |
| 64 | + Turn off this advice by setting config variable advice.detachedHead to false |
| 65 | + |
| 66 | + HEAD is now at bb282e9 add file1 |
| 67 | + $ tree |
| 68 | + . |
| 69 | + `-- sub1 |
| 70 | + `-- file1 |
| 71 | + |
| 72 | + 1 directory, 1 file |
0 commit comments