Most Plugins are developed to be shared among many projects, Unreal Has a good way to do this by installing them on the Engine installation if you purchase them via Marketplace or if you use the ones included in the Engine. But if you have private Plugins that you want to share among many projects, or you just want to benefit from Git’s Submodules system.
Open the Git repository of your current project and type the following command:
git submodule add https://github.com/BionicApe/YourPluginRepoName Plugins/YourPluginRepoName
The only problem it might arise is if you already have include it in your repo or if Plugins is in the .gitignore file.
The Main reason to have it like this can be that you are progressing on the development of your project using this Plugin and you want to make changes to the Plugin without the needing to go to another Project, make the changes and then come back and merge it.
To do so, just follow the submodules guide, the way I normally do it, is just go to the “Plugins/MyModule” folder and open a command line and type:
cd Plugins/MyPlugin/
git add . -v
git commit
git push
Then you can pull all the submodules recursively by doing:
If it’s the first time you check-out a repo you need to use –init first:
git submodule update --init --recursive
For git 1.8.2 or above, the option –remote was added to support updating to latest tips of remote branches:
git submodule update --recursive --remote
This has the added benefit of respecting any “non default” branches specified in the .gitmodules or .git/config files (if you happen to have any, default is origin/master).
Plugins are awesome! Reuse your code, multiply your productivity!
BONUS 1: USE YOUR CONTENT FOLDER AS A SEPARATE SUBMODULE
You can also put your content folder in a separate repository, so it can be shared with other developers that might not have granted access to the source code. To do so, do the following:
git submodule add https://github.com/BionicApe/YourContentRepoName Content
BONUS 2: GIT SUBMODULES CHEATSHEET
Clone repo with submodules included
git clone https://github.com/BionicApe/Repo --recursive
Create a submodule in a currently existing repo
git submodule add https://github.com/BionicApe/Repo Plugins/Repo
git submodule update --init --recursive
git commit -m 'Added new Plugin'
To update the path of the submodule
git submodule init
git mv oldpath/submodule newpathsubmodule
git submodule update
Delete unused Submodule
Remove referencing lines in .gitmodules
Remove referencing lines in .git/config
rm -rf submodule-dir/
git add
git commit -m "removing submodule"
Push submodules
git push --recurse-submodules=check
The following submodule paths contain changes that can
not be found on any remote:
DbConnectorPlease try git push --recurse-submodules=on-demandor cd to the path and use git pushto push them to a remote.$ git push --recurse-submodules=on-demand
Pushing submodule 'DbConnector'
Counting objects: 9, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (9/9), 917 bytes | 0 bytes/s, done.
Total 9 (delta 3), reused 0 (delta 0)
To https://github.com/BionicApe/Repo
c06e92a..72d1ad3 stable -> stable
Counting objects: 2, done.
Delta compression using up to 6 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 266 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 0 (delta 0)
To https://github.com/BionicApe/MainProject
3d6d338..9a544d1 master -> master
Foreach comamand
git submodule foreach 'git stash'
Entering 'MySubmodule'
No local changes to save
Entering 'MyOtherSubmodule'
Saved working directory and index state WIP on stable: 82d2ad3 Merge from origin/stable
HEAD is now at 82d2ad3 Merge from origin/stable