Search code examples
gitgithubversion-controlrepositorygitignore

Pushing and maintaining backend(Django) and frontend(Angular) folder in one repo


I have searched in google about this many says we can do this in two ways :

  1. creating the main repo and having one .gitignore file in there and pushing all in one repo.
  2. Maintaining separate git repo i.e for backend separate repo and frontend separate repo.

So, I chose second-way i.e maintaining and pushing separate repo and I have structure projects with the backend(Django) and frontend (Angular) folders. But doing that creates a separate GitHub repo and I don't want to have a separate Github repo.

What I want: I want to create in one repo with the folders backend and frontend but they should be maintained separately.

My questions:

  1. How do I maintain and push in GitHub repo with separate backend and frontend folders in one repo?
  2. Is there any best practices? Please let me know how can I do it?

Solution

  • Branches Git

    What you can do is have everything in same repository and create branches in GIT. Branches help you maintain functionality of the Master branch till the time you are done with your other branches in terms of developing and testing.

    When working with branches it is important to not change anything that might be worked upon in other branch by some other user, which leads to merge conflicts and you can surely sort them out but sometimes too many merge conflicts are hectic to deal with.

    Merge requests: Lets say Backend Branch is working on User Profile Backend and there is a button to Create Google Account Connection. So everyone worked and created the backend to do everything required for the task. Now UI Branch guys are faster and they committed before the Backend Branch Developers.

    UI Branch Developers made a change in the post request to the backend with key name changed from g_id to google_id.Now the Developer Branch need to first pull the changes made in master and then work forward and make changes for the changes in UI and then move for a commit to master branch.

    In Short,you can use Branches to work with different aspect of your project.