How to push only a single file of a commit to different repository using git?
For example I have a directory like this-
dir
|---- subdir1
| |------- file1
|---- file2
I used git to add all files and folders, and committed them all, and then pushed it to a local github repo that I want to keep for myself to work over different devices. Now I made a program, say file2, that I want to show at my school, and obviously there I can't login to my account to look over the local repo, nor do I want to change my repo from local to public as it contains few waste files as well, for example- HelloWorld, few books, etc. For this I want to create a public repo and push only file2 to the public repo. How can this be done? Or would I have to create a different dir sibling to the parent dir and move file2 there, and then do git stuff?