I just want to know if this is possible.
Currently I'm working on a Spring Boot project, it's application.properties
file contains some sensitive information like passwords etc., and I'm trying to connect this github branch with my Heroku app to automate deployments.
The simple answer is that the nearest thing that you describe is to create a private clone, and you could then I guess create a branch on that.
The more complex answer would be to question what you are doing in the first place. Since git does not directly support selective merging of a branch back to the truck (e.g. main), you would end up with a branch that could not be merged. Any work added to that branch could not be merged either. The second observation is that you should not really be adding secret stuff like passwords into git. It is not suitable - you might as well leave them in a big sheet of paper and show everyone:)
You really need to be considering an alternative approach to secrets, and that would probably solve your problem. Most CI/CD/build systems have some sort of secret store, and writing test code to use that approach is recommended. Even locally, some equivalent - where the secrets are supplied outside the SCM - is best practice.