Using git inside devcontainer for saving custom_components changings

I’ve discovered that no one has yet write a way to use git locally to develop custom_components inside devcontainer so that you don’t have to copy-paste.

Instruction

  1. First, clone repository inside /config/ folder
     cd /config/
     git clone <github repository>
    
  2. Second, copy .git/ folder in /config/ folder
    cp -r <github repository>/.git/ .git/
    
  3. Than you need to create .gitignore file and write it inside
    *
    !.gitignore
    !custom_components/ # will not ignore all this folder
    custom_components/* # will ignore all folder in this folder
    !custom_components/<name of component> # will NOT ignore you component folder
    !custom_components/<name of component>/** # will NOT ignore all inside your component folder
    
  4. After that you need to check in console that in terminal you use local git data. You can use this commands to handle git in terminal
    git add . # add file(s)/folders to git handling
    git commit -m "Your comment"
    git push
    git pull