I have this dictionary hierarchy:
.
|-- Test
| |-- file_c.z
| `-- sub-dir
| |-- file_d.t
| `-- file_e.q
|-- file_a.x
|-- file_b.y
`-- .gitignore
Now how can I tell git ignore everything except file_a.x
and file_e.q
?
I have this dictionary hierarchy:
.
|-- Test
| |-- file_c.z
| `-- sub-dir
| |-- file_d.t
| `-- file_e.q
|-- file_a.x
|-- file_b.y
`-- .gitignore
Now how can I tell git ignore everything except file_a.x
and file_e.q
?
Add following to your .gitignore
# Ignore everything
*
# Don't ignore .gitignore and your specific files files
!.gitignore
!file_a.x
!Test/sub-dir/file_e.q
you can exclude files from gitignore patterns with '!'
just write
Test/
!file_a.x
!file_e.q
in your .gitignore