| 47 | |
| 48 | == Stashing untracked files == |
| 49 | |
| 50 | At times you will be working on a branch with untracked files (new files) and you'll need to checkout master to apply a bug fix. |
| 51 | |
| 52 | First, add the untracked files to the index: |
| 53 | {{{ |
| 54 | #!sh |
| 55 | git add <untracked-files> |
| 56 | }}} |
| 57 | |
| 58 | Now do a regular stash: |
| 59 | {{{ |
| 60 | #!sh |
| 61 | git stash |
| 62 | }}} |
| 63 | |
| 64 | At this point you can checkout whatever branch you want and do what you need to do. When you're done, checkout your original working branch again and pop the changes from your stash: |
| 65 | |
| 66 | {{{ |
| 67 | #!sh |
| 68 | git stash pop |
| 69 | }}} |
| 70 | |
| 71 | You can remove the files you indexed from the index if you want, as to not pollute your next commit: |
| 72 | {{{ |
| 73 | #!sh |
| 74 | git rm --cached <files> |
| 75 | }}} |