Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible to `git push` project to a certain folder in GitHub repository?

I have a frontend and backend for my project. They both reside in two different folder locally, so they are completely separate. I want them to share the same GitHub repo though, for example, could the repo have 2 folders called frontend and backend that can be used to hold the appropriate code?

If so, what commands are used to push the source code from each project into the frontend or backend folders?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This is a confused question but I will try to give you an answer.

If this is your structure:

  • my_project (repo)
    • frontend (folder)
    • backend (folder)

Then that is just an arbitrary folder tree in the my_project repo. Just commit and push as normal. It doesn’t make any difference where the changes are made.

You could use git submodules. This would allow you to separate the projects

  • my_project (repo)
    • frontend (repo, submodule)
    • backend (repo, submodule)

my_project may contain environment or other generic configurations and each of the submodules are independent repositories. Changes in each are controlled separately but still with simple commit, push.

If you want to convert from folders to repositories then simply copy the folder out of the current git tree and run git init, then push it.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading