Remove a project

dfetch remove deletes a project from your manifest and removes its directory from disk. Use it when you no longer need a dependency.

Removing a single project

Pass the project name to dfetch remove:

$ dfetch remove mylib

Dfetch removes the project entry from dfetch.yaml and deletes the destination folder. The manifest is updated in-place when inside a Git or SVN repository, preserving comments and formatting. Outside version control, a .backup copy is created first.

Example: Remove an existing project
../features/remove-project.feature
 Given the manifest 'dfetch.yaml'
        """
        manifest:
          version: '0.0'

          projects:
            - name: lib-alpha
              url: some-remote-server/LibAlpha.git
              dst: ext/lib-alpha

            - name: lib-beta
              url: some-remote-server/LibBeta.git
              dst: ext/lib-beta

        """
When I run "dfetch remove lib-alpha"
Then the manifest 'dfetch.yaml' is replaced with
        """
        manifest:
          version: '0.0'

          projects:
          - name: lib-beta
            url: some-remote-server/LibBeta.git
            dst: ext/lib-beta

        """
And the directory 'ext/lib-alpha' should be removed from disk
And the output shows
        """
        Dfetch (0.13.0)
          lib-alpha:
          > removed
        """
Example: Remove multiple projects atomically
../features/remove-project.feature
 Given the manifest 'dfetch.yaml'
        """
        manifest:
          version: '0.0'

          projects:
            - name: lib-alpha
              url: some-remote-server/LibAlpha.git
              dst: ext/lib-alpha

            - name: lib-beta
              url: some-remote-server/LibBeta.git
              dst: ext/lib-beta

        """
When I run "dfetch remove lib-alpha lib-beta"
Then the manifest 'dfetch.yaml' is replaced with
        """
        manifest:
          version: '0.0'

          projects: []

        """
And the directory 'ext/lib-alpha' should be removed from disk
And the directory 'ext/lib-beta' should be removed from disk
And the output shows
        """
        Dfetch (0.13.0)
          lib-alpha:
          > removed
          lib-beta:
          > removed
        """
Example: Removing a project that does not exist in the manifest is reported
../features/remove-project.feature
 Given the manifest 'dfetch.yaml'
        """
        manifest:
          version: '0.0'

          projects:
            - name: lib-alpha
              url: some-remote-server/LibAlpha.git
              dst: ext/lib-alpha

            - name: lib-beta
              url: some-remote-server/LibBeta.git
              dst: ext/lib-beta

        """
When I run "dfetch remove lib-alpha lib-unknown lib-beta"
Then the manifest 'dfetch.yaml' is replaced with
        """
        manifest:
          version: '0.0'

          projects: []

        """
And the directory 'ext/lib-alpha' should be removed from disk
And the directory 'ext/lib-beta' should be removed from disk
And the output shows
        """
        Dfetch (0.13.0)
          lib-unknown:
          > project 'lib-unknown' not found in manifest
          lib-alpha:
          > removed
          lib-beta:
          > removed
        """
Example: Removing a project that was never fetched still removes it from the manifest
../features/remove-project.feature
 Given the manifest 'dfetch.yaml'
        """
        manifest:
          version: '0.0'

          projects:
            - name: lib-gamma
              url: some-remote-server/LibBeta.git
              dst: ext/lib-gamma

            - name: lib-alpha
              url: some-remote-server/LibAlpha.git
              dst: ext/lib-alpha

        """
And the directory 'ext/lib-gamma' does not exist on disk
When I run "dfetch remove lib-gamma"
Then the manifest 'dfetch.yaml' is replaced with
        """
        manifest:
          version: '0.0'

          projects:
          - name: lib-alpha
            url: some-remote-server/LibAlpha.git
            dst: ext/lib-alpha

        """
And the output shows
        """
        Dfetch (0.13.0)
          lib-gamma:
          > removed
        """

Removing multiple projects

List multiple project names to remove them all at once:

$ dfetch remove lib1 lib2 lib3

Each project is removed from the manifest and its directory deleted.

Manifest backup behavior

When your manifest lives inside a Git or SVN repository, dfetch remove edits it in-place to preserve comments, blank lines, and indentation. When outside version control (no .git or .svn directory), a backup copy is created as dfetch.yaml.backup before any changes.

This matches the behavior of dfetch freeze and other manifest-modifying commands.