How to organise git repos when building on a seed project

前端 未结 2 1103
说谎
说谎 2021-02-10 07:07

I am building a site based on an seed project (MEAN.io) which I cloned from github. How do I separate these files from my own files. As this seed gives a wide skeleton of files,

相关标签:
2条回答
  • 2021-02-10 07:36

    If you want to built your OWN code INSIDE the code from the other git repo, the only way to go about it is to merge the other git repo inside yours each time.

    To do this easily you can checkout the other git repo in a separate branch (or even git submodule), and merge this branch (or submodule) back in the master branch where your code is.

    0 讨论(0)
  • 2021-02-10 07:38

    Commit your files to a branch.

    $ git clone https://github.com/linnovate/mean.git myproject
    $ cd myproject
    $ git branch myproject   # create myproject branch
    $ git checkout myproject # switch to that branch
    $ echo "A File for just my project" > myfile
    $ git commit myfile -m "Adding a file just for my project"
    

    All of your changes will be independent from the seed project. If you want to keep up to date and see where the seed project is all you need to do is this:

    $ git checkout master
    $ git pull
    

    Now all of your files will be gone and you will see what the latest stuff in MEAN looks like. If you wish for your project to get their changes you would do this:

    $ git checkout myproject
    $ git merge master
    

    Of course there are a ton of ways to do this (search for tracking branches).

    If you intend to use MEAN.io as a subdirectory in your project all of this still applies (just within the submodule).

    0 讨论(0)
提交回复
热议问题