Skip to content

WBakerOMS/Submodule_POC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Submodule_POC

This repository is to test submodules. There are two submodule used in this example: feature1, and feature2. Both have includes are imported into the main file and defines are printed out to show that they're being used.

A caveat of this setup is that both feature modules are branches in the same (this) repository. So they have been put in separate folders to avoid name conflicts.

Helpful Links

  • Here is the reference guide for the commands.
  • Here are more detailed instructions from the git v2 book.

Commands

These instructions assume that you are already in a git repository.

Clone

git clone --recurse-submodules <URL>

To clone a repository and all of it's submodules.

Add

git submodule add [-b <branch>] [--name <name>] <URL> [<path>]

Adds a git repository to the current repository. Note that with the path it will create the subdirectory for you.

Move

git mv <source dir> <destination dir>

Git support mv as in linux. You can therefore move submodule directories if included into the wrong path.

Update

git submodule update --remote

Update all submodules.

cd <submodule>
git pull <branch>

Update individual submodules.

C++ .vscode Configuration

Sometimes setting up the environment for C/C++ can be annoying, here are the .vscode file settings I used. After following these steps to install a compiler.

launch.json

{
    "configurations": [
        {
            "name": "C/C++: g++.exe build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "C:\\msys64\\ucrt64\\bin",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\msys64\\ucrt64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file"
        }
    ],
    "version": "2.0.0"
}

tasks.json

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\msys64\\ucrt64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:\\msys64\\ucrt64\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

About

This repository is to test submodules

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages