Git simplifying a subtree if not contributing to the upstream?

What optimizations exist (including even alternatives to the git subtree) if you want to include a subproject in your main project, but not make changes to the starting position?

Actual use case: I embed Ghost in an existing express.js site, for example. in lib / ghost. I will need to make a few hacks, such as they would not like to contribute to the game upstream. Any normal contribution to the Ghost project will be made using typical forking on GitHub, and not from my other project.

Therefore, after the initial implementation of Ghost in my project, the only thing that happens is a random change in the source code, and sometimes extraction from the upstream for updates from their main branch.

In such a scenario, the git subtree is still the appropriate approach, and if so then are there any corrections or simplifications that will be applied, because of this need to never contribute to the upstream? And will it also be possible for the main TryGhost / Ghost repository to be my subtree upstream, instead of first deploying Ghost and then having the plug as an upstream project?

+4
source share
1 answer

Subtree .

- , , .

  • , , , .
  • , , .
  • - cinch, , , git, ( ).

, , , , , , ?

  • , :

    git subtree add --prefix Ghost --squash -m "Adding Ghost." https://github.com/TryGhost/Ghost.git master
    

    , Ghost. , .

  • , .

    git remote add ghost https://github.com/TryGhost/Ghost.git
    git subtree pull --prefix=Ghost --squash -m "Updating Ghost." ghost master
    
  • , - , , , , , fork.

    git subtree split -p Ghost -b Ghost-contrib-br --rejoin
    # this should switch to the branch with only the ghost files
    
    git push <remote-contrib-repo>
    

    . --squash, , --rejoin

    --rejoin , , split . , .git/config ( ).

+3

All Articles