What is the best approach for custom the erpnext in development docker container and my owen repo?

I have successfully set up the development environment following the instructions in development.md for frappe_docker. I want to commit my changes to my own Gitee repository. However, the .gitignore file has the following settings:

1development/*
2!development/README.md
3!development/installer.py
4!development/apps-example.json
5!development/vscode-example/

During setup, the installation script added the erpnext Git repository under apps/erpnext. If I need to customize erpnext and commit these changes to my own repository, what is the best approach?

Method 1: Not Using .gitignore

Method 2: Using Submodules or Subrepositories

Method 3: Using .git/info/exclude

or any other motheds?

The best approach for customizing and committing your changes to erpnext in the frappe_docker development environment would be to use Git submodules.

Method 2: Using Submodules or Subrepositories

Git submodules allow you to include one Git repository as a subdirectory of another Git repository. This is the recommended approach in the frappe_docker development environment, as it allows you to track your custom changes to erpnext separately from the main erpnext repository.

Here’s how you can set it up:

  1. Navigate to the apps directory in your frappe_docker development environment.
  2. Remove the existing erpnext directory:
    rm -rf apps/erpnext
    
  3. Add the erpnext repository as a submodule:
    git submodule add https://github.com/frappe/erpnext.git apps/erpnext
    
  4. This will create a .gitmodules file in your main repository, which tracks the erpnext submodule.
  5. Make your custom changes to the erpnext submodule.
  6. Commit your changes to the erpnext submodule:
    cd apps/erpnext
    git add .
    git commit -m "Your commit message"
    
  7. Finally, commit the changes to your main repository, including the updated .gitmodules file:
    cd ../..
    git add .
    git commit -m "Update erpnext submodule"
    

Now, when you push your main repository to your Gitee repository, the erpnext submodule will be included, and your custom changes will be tracked separately from the main erpnext repository.

The other methods you mentioned (Method 1: Not Using .gitignore and Method 3: Using .git/info/exclude) are not recommended in this case, as they would either include the entire erpnext repository in your main repository (which would result in a large repository) or require manual exclusion of files, which can be error-prone.

Using Git submodules is the cleanest and most maintainable approach for customizing erpnext within the frappe_docker development environment.