exclude Command

Remove git-tracked files matching exclude configuration from git tracking. ABAP objects are never touched — only git tracking is affected.

Command

abapgit-agent exclude

What It Does

  1. Reads exclude config (patterns and/or unsupportedTypes) from .abapgit-agent.json
  2. Runs git ls-files to list all tracked files
  3. Filters files matching any of the glob patterns
  4. Runs git rm --cached to untrack matching files
  5. Commits the removal with message: chore: exclude ABAP objects per .abapgit-agent.json

The files remain on disk and in the ABAP system — only their git tracking is removed.

When to Use

Use this command after configuring exclude in .abapgit-agent.json to clean up files that were previously tracked but should no longer be:

  • unsupportedTypes: true — catch-all after import: removes BADI, W3MI, XSLT, WDYN, and any other types abapGit cannot pull or activate
  • patterns — target specific supported-type files by name pattern (e.g. SEGW-generated DPC/MPC classes that cause activation failures)

Configuration

Add an exclude section to .abapgit-agent.json:

{
  "exclude": {
    "unsupportedTypes": true,
    "patterns": [
      "zcl_*_dpc*.clas.*",
      "zcl_*_mpc*.clas.*",
      "src/aud_legacy/**"
    ]
  }
}

The first two are basename patterns (no /) — they match SEGW-generated DPC/MPC classes anywhere in the repo. The third is a path pattern — it excludes every file under src/aud_legacy/.

unsupportedTypes: true — automatically excludes any file whose object type (the middle dot-segment of the filename, e.g. badi in zfoo.badi.xml) is not in the set of types supported by abapgit-agent: CLAS, INTF, PROG, FUGR, TABL, DTEL, TTYP, DOMA, DDLS, DCLS, MSAG, STRU, ENHO, SUSO, PINF. Use this after import to remove all types abapGit cannot activate.

patterns — explicit glob patterns. Two styles, distinguished by whether the pattern contains a forward slash:

  • Without / — basename match. Matched against the file’s basename (directory stripped). Examples:
    zcl_*_dpc*.clas.*       # SEGW-generated data-provider classes
    cl_temp_*.clas.*        # any "temp" class anywhere in the repo
    
  • With / — full-path match. Matched against the full relative path. Use ** for cross-segment matching. Examples:
    src/aud_legacy/**                    # exclude a whole folder/package
    src/aud_*/cl_temp_*.clas.*           # wildcards in the directory portion
    src/aud_legacy/**/*.clas.*           # only CLAS files under a folder
    

Matching is case-insensitive.

Path-based patterns and import: the ABAP-side filter inside import only sees file basenames. Path patterns (those containing /) are silently skipped during import and a warning is printed. They DO take effect for exclude and pull --files. Run abapgit-agent exclude after import to prune the unwanted files from git.

Effect on Other Commands

Once patterns are configured:

  • pull — files matching exclude config are skipped with a warning
  • import — excluded files are filtered before staging/committing to git

Example

# Configure exclusions in .abapgit-agent.json, then run:
abapgit-agent exclude

# Output:
#   Checking exclude patterns from .abapgit-agent.json...
#   Found 2 pattern(s): zcl_*_dpc*.clas.*, zcl_*_mpc*.clas.*
#
#   Files to remove from git:
#      abap/zcl_zsegw_dpc.clas.abap
#      abap/zcl_zsegw_dpc.clas.xml
#      abap/zcl_zsegw_mpc.clas.abap
#
# ✅ Removed 3 file(s) from git. ABAP objects remain untouched.
#    Committed as: chore: exclude ABAP objects per .abapgit-agent.json

Prerequisite

  • Current folder is a git repository
  • .abapgit-agent.json exists with exclude.patterns and/or exclude.unsupportedTypes: true

Back to top

Copyright © 2024-2026 abapGit Agent. Distributed under MIT License.

This site uses Just the Docs, a documentation theme for Jekyll.