In my sbt-project I have some files that I do not want to share with my colleagues as they are personal notes and stuff like that. I want to have them .gitignore
d. How can I do this. I placed a folder personal
into the project and added a .gitignore there with the line
../personal/
I hoped that would hide the folder personal (including the responsible .gitignore) from git, but it seems this is not valid for git. How can I achieve this?
Also /personal/ does not work as hoped.
In your personal
directory create a .gitignore
file with the following content:
*
personal
directory and any files inside it.personal
directory is not possible using this approach (at least I don't know how to achieve this using this option).Add the following lines to the .git/info/exclude
file:
/personal
*.dictionary
personal
directory and any files inside it..dictionary
suffix no matter if they are inside or outside the personal
directory. Files already tracked by Git are not affected. The purpose of gitignore files is to ensure that certain files not tracked by Git remain untracked. To stop tracking a file that is currently tracked, use git rm --cached
.
gitignore man page: See section "Description" to get an overview about the different options which exist to ignore files within a git repository and when to use which option.
add a .gitignore file on your project's root directory like below
sbt-project
|_ app
|_ personal
|_ .gitignore
The paths you add on .gitignore
to be skipped should be relative to the directory where .gitignore
file is located. In this case, add this line to skip all contents of your personal
directory inside sbt-project
personal/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With