Sample applications have a git repository already created

Like many people, I want to build an application from a nordic sample.

But every sample application I create with vs code has version control already present. Git commands to figure out where the repo is located don't seem to return any results.

I have read through this, which seems to be titled with what I want to do, but am not able to understand how to apply it to my problem. developer.nordicsemi.com/.../adding_code.html

What is the correct way to transition from a sample application to a version controlled application in your own repository?

Thank you.

nrf sdk 2.4.2 in vscode

  • Hi,

    But every sample application I create with vs code has version control already present. Git commands to figure out where the repo is located don't seem to return any results.

    There won't be any version control for your newly created sample by default, but if it is created within the nRF connect SDK for instance, that already consists of a set of git repositories, so perhaps that is what confuses?

    What is the correct way to transition from a sample application to a version controlled application in your own repository?

    There is no single "correct" way, as there are different approaches that are suitable for different use cases. If you want to keep things simple and you don't plan to make any changes to the SDK itself, a good idea could be to make a separate git repository for your sample that you keep some where separate from the nRF Connect SDK files. Then add your code there. This is how I normally do things. For instance, if you want to say make your own project based on the Bluetooth peripheral HR sample from zephyr/samples/bluetooth/peripheral_hr/, take all those files and copy into your own git repository. Then, open the nRF Connect SDK with VS code, and open the project from "Open an existing application":

  • Hello Einar. Thank you! That is helpful indeed.

    The method I was using to create an application from a sample was to do 

    Create a new application > Copy a sample > (selecting relevant sample application)

    Using this method populates the application directory with git tracking files. 

    Presumably there is a rationale for this, but as a casual git user it was more challenge than convenience! Please double check with the dev team to ensure this is serving some other helpful purpose. I would contend that my method is what the software "guides" you to do.

  • I do not get a .git folder in the application I create with the approach you describe, and that should not be the case. Can you double check? 

    If you are able to reproduce, can you generate support information (that has details on versions etc) as shown here and upload to this case?

  • Hi Einar, it is reproduceable for me. The two projects I created to test are machine-learning and peripheral-hids-mouse

    Here's my info and the generated git files.

    [09:49:23] Update available https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-10-x-x/10-23-0/nrf-command-line-tools-10.23.0-x64.exe
    IMPORTANT: The data below could contain sensitive or confidential information about your environment.
    If you do not wish this to be seen by others, please make sure to remove it before sharing.
    
    For help and support, visit the Nordic DevZone at https://devzone.nordicsemi.com/.
    
    {
      "platform": {
        "os": "win32",
        "osVersion": "Windows 10 Pro",
        "osKernel": "10.0.19045",
        "vscode": "1.82.2",
        "electron": "25.8.1",
        "node": "v18.15.0"
      },
      "system": {
        "date": "2023-09-28T16:49:22.126Z",
        "vscodeRoot": "c:\\Users\\user-name\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "00:00:07",
        "osUptime": "341:54:07",
        "cpu": "Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz"
      },
      "workspace": {
        "name": null,
        "workspaceFile": null,
        "folders": []
      },
      "sdks": [
        {
          "version": "2.4.0",
          "path": "c:\\ncs\\v2.4.0"
        },
        {
          "version": "2.4.2",
          "path": "c:\\ncs\\v2.4.2"
        }
      ],
      "apps": [],
      "topdir": "c:\\ncs\\v2.4.2",
      "workspaceState": "empty-ready",
      "toolchains": [
        {
          "version": "2.4.0",
          "path": "c:\\ncs\\toolchains\\31f4403e35"
        }
      ],
      "connectedDevices": [],
      "deviceProvider": "nrfjprog",
      "tools": {
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gcc.exe": "0.16.0",
        "C:\\Program Files\\SEGGER\\JLink\\JLink.exe": "7.80c",
        "C:\\Program Files (x86)\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\nrfjprog.exe": "10.15.4",
        "C:\\Users\\user-name\\AppData\\Local\\Programs\\Python\\Python37\\Scripts\\nrfutil.exe": null,
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\cmake.exe": "3.20.5",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\Scripts\\west.exe": "1.0.0",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\python.exe": "3.8.2",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\ninja.exe": "1.9.0",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\gperf.exe": "3.1",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\dtc.exe": "1.4.7",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\gn.exe": "2105",
        "C:\\ncs\\toolchains\\31f4403e35\\mingw64\\bin\\git.exe": "2.37.3.windows.1",
        "gdbPath": "c:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gdb.exe"
      },
      "environment": {
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\user-name",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\user-name",
          "PATH": "C:\\ncs\\toolchains\\31f4403e35;C:\\ncs\\toolchains\\31f4403e35\\mingw64\\bin;C:\\ncs\\toolchains\\31f4403e35\\bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\Scripts;C:\\ncs\\toolchains\\31f4403e35\\opt\\nanopb\\generator-bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\aarch64-zephyr-elf\\bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\x86_64-zephyr-elf\\bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin;c:\\Users\\user-name\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2023.9.336-win32-x64\\platform\\nrfutil\\lib\\nrfutil-toolchain-manager;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\3.0\\bin\\x86;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\3.0\\bin\\x64;C:\\Program Files (x86)\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Program Files\\dotnet\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Microchip\\xc8\\v2.41\\bin;C:\\Users\\user-name\\AppData\\Local\\Programs\\Python\\Python37\\Scripts\\;C:\\Users\\user-name\\AppData\\Local\\Programs\\Python\\Python37\\;C:\\Program Files (x86)\\GNU Tools Arm Embedded\\7 2018-q2-update\\bin;C:\\Users\\user-name\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\Git\\mingw64\\bin\\;C:\\Program Files\\7-Zip;C:\\Users\\user-name\\AppData\\Roaming\\cabal\\bin;C:\\tools\\ghc-9.4.4\\bin;C:\\ghcup\\bin;C:\\Users\\user-name\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\user-name\\Downloads\\ffmpeg-master-latest-win64-gpl\\ffmpeg-master-latest-win64-gpl\\bin;",
          "ZEPHYR_BASE": "c:\\ncs\\v2.4.2\\zephyr",
          "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
          "ZEPHYR_SDK_INSTALL_DIR": "C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk",
          "PYTHONPATH": "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\Lib;C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\Lib\\site-packages"
        },
        "inherited": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\user-name",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\user-name",
          "Path": "C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\3.0\\bin\\x86;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\3.0\\bin\\x64;C:\\Program Files (x86)\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Program Files\\dotnet\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Microchip\\xc8\\v2.41\\bin;C:\\Users\\user-name\\AppData\\Local\\Programs\\Python\\Python37\\Scripts\\;C:\\Users\\user-name\\AppData\\Local\\Programs\\Python\\Python37\\;C:\\Program Files (x86)\\GNU Tools Arm Embedded\\7 2018-q2-update\\bin;C:\\Users\\user-name\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\Git\\mingw64\\bin\\;C:\\Program Files\\7-Zip;C:\\Users\\user-name\\AppData\\Roaming\\cabal\\bin;C:\\tools\\ghc-9.4.4\\bin;C:\\ghcup\\bin;C:\\Users\\user-name\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\user-name\\Downloads\\ffmpeg-master-latest-win64-gpl\\ffmpeg-master-latest-win64-gpl\\bin;",
          "PATH": "C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\3.0\\bin\\x86;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\3.0\\bin\\x64;C:\\Program Files (x86)\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Program Files\\dotnet\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Microchip\\xc8\\v2.41\\bin;C:\\Users\\user-name\\AppData\\Local\\Programs\\Python\\Python37\\Scripts\\;C:\\Users\\user-name\\AppData\\Local\\Programs\\Python\\Python37\\;C:\\Program Files (x86)\\GNU Tools Arm Embedded\\7 2018-q2-update\\bin;C:\\Users\\user-name\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\Git\\mingw64\\bin\\;C:\\Program Files\\7-Zip;C:\\Users\\user-name\\AppData\\Roaming\\cabal\\bin;C:\\tools\\ghc-9.4.4\\bin;C:\\ghcup\\bin;C:\\Users\\user-name\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\user-name\\Downloads\\ffmpeg-master-latest-win64-gpl\\ffmpeg-master-latest-win64-gpl\\bin;"
        },
        "toolchainPath": "c:\\ncs\\toolchains\\31f4403e35",
        "toolchainBinPath": "c:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin",
        "toolchainVersion": "2.4.0"
      },
      "terminal": {
        "defaultProfile": null
      },
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "",
          "toolchain": {
            "path": "PATH"
          },
          "ozonePath": "",
          "applications": [],
          "applicationOptions": {},
          "kconfig": {
            "interface": "kconfig",
            "executeInDefaultShell": false
          },
          "welcome": {
            "showOnStartup": true
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "taskBindings": {},
          "debugging": {
            "flash": true,
            "bindings": {}
          },
          "activeAppFollowActiveEditor": true,
          "deviceProvider": "nrfjprog",
          "enableTelemetry": true,
          "thirdpartyIntegration": {},
          "toolchainManager": {
            "indexURL": null,
            "installDirectory": null
          },
          "nrfutil": {
            "home": null
          },
          "defaultOpenAction": "ask"
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        }
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2023.9.336",
            "path": "c:\\Users\\user-name\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2023.9.336-win32-x64",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2023.9.29",
            "path": "c:\\Users\\user-name\\.vscode\\extensions\\nordic-semiconductor.nrf-terminal-2023.9.29",
            "isActive": true
          },
          "nordic-semiconductor.nrf-devicetree": {
            "version": "2023.9.57",
            "path": "c:\\Users\\user-name\\.vscode\\extensions\\nordic-semiconductor.nrf-devicetree-2023.9.57",
            "isActive": true
          },
          "nordic-semiconductor.nrf-kconfig": {
            "version": "2023.9.94",
            "path": "c:\\Users\\user-name\\.vscode\\extensions\\nordic-semiconductor.nrf-kconfig-2023.9.94",
            "isActive": true
          }
        },
        "external": {
          "marus25.cortex-debug": null,
          "ms-vscode.cpptools": "1.17.5",
          "ms-vscode-remote.remote-wsl-recommender": "0.0.19",
          "ms-vscode.js-debug": "1.82.0",
          "ms-vscode.js-debug-companion": "1.1.2",
          "ms-vscode.vscode-js-profile-table": "1.0.3",
          "GitHub.copilot": "1.119.448",
          "GitHub.copilot-chat": "0.7.1",
          "ms-python.python": "2023.16.0",
          "ms-python.vscode-pylance": "2023.9.20",
          "ms-vscode.cpptools-extension-pack": "1.3.0",
          "ms-vscode.cpptools-themes": "2.0.0",
          "ms-vsliveshare.vsliveshare": "1.0.5883",
          "platformio.platformio-ide": "3.3.1",
          "trond-snekvik.gnu-mapfiles": "1.1.0"
        }
      }
    }
    
    
    created-git-files.zip

  • Hi,

    I seems I did not test the most recent version the last time, I see the same as you now. A git repo is automatically created when you make a new application. We have received feedback that this may not be desirable and are looking into it, but for now, it is not configurable. So at this point, the simplest is probably to delete the .git folder and .gitignore file after creating the application if you do not want it.

Related