Let say I have two branches in my Git repository.
- master
- slave
Now while in master, I created a file (holding some sensitive information)
called apikey.env. I added it to .gitignore file since I don't want to commit it. After that I committed the .gitignore with the new record.
Now, when I checkout to slave branch, I still find the apikey.env file there, about which, git says that it is untracked. If I delete the file, I gets removed from master branch as well.
So, what I want is that the file apikey.env should appear only in master branch but not in the slave branch, and I don't want to commit the file even in master branch. What is the best way to achieve this?
 
     
    