Joke Collection Website - Public benefit messages - One Git repository manages multiple Git projects

One Git repository manages multiple Git projects

Usually I use git to manage all the data that needs to be stored.

I need to use a command to submit all git repositories at work to my own Alibaba Cloud or Dropbox on, use it in different places.

Another benefit of using git with Dropbox is that since .gitignore ignores many public resources, Dropbox only needs to store very little content:

As shown in the picture, all my project files are 8.75GB, but only a 430MB warehouse is saved on Dropbox, and it also has Git version management function.

If you have the same needs as me , this article will help you.

First of all, make sure you have a Nodejs environment and install merge-sub-gits

The idea is very simple:

Add The -l parameter will print the rename log

It is very cumbersome to use the merge-sub-gits command every time including the git commit operation. We can add the following content to the ~/.bash_profile file:

We usually need to put work files into various network drives to facilitate synchronization between work and home, but Dropbox\iCloud and other network drives do not allow folder ignoring and a more detailed file history of Git.

For example, a React front-end project is about a few hundred MB. If you ignore the node_modules folder, there will be only a dozen MB left.

We can put all the information related to work and computer environment. Put a work file and use merge-sub-gits to synchronize the contents of the folder to the network disk:

We have created a warehouse in Dropbox and cloned it locally. Next we copy Put all the files that need to be backed up into the ~/backup-all folder, and then continue with the following operations:

As mentioned above, through the .gitignore file and git compression, the 8.75GB content is It becomes 430MB for network disk management, and also has Git version management function.

Since a lot of historical information is saved in the Git warehouse, with long-term use, the Git warehouse will slowly and gradually increase in size. Since all our sub-projects retain their own Git history, if one day the root Git repository becomes too redundant, we only need to delete Dropbox's Git and resubmit.

If the root Git repository was once used, If git commit is used in the project, the sub-git project will be marked as ignored submission

In this case, the git record needs to be cleared:

Welcome Star: github.com/ymzuiku/merge-sub -gits