---
schema_version: "1"
id: c2f01aa5f6e7c669ea1d3a5f099bd42d6c2fff5b946bab0f52d3bb41c094e2c9
title: Retrieve Source
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfvscode/guides/deploy-retrieve/retrieve-source.md
canonical_url: https://developer.salesforce.com/docs/platform/sfvscode-extensions/guide/retrieve-source.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 31245b2380409b846a94ce3a31f26480f135cefb5f8da42f0b2b86498012be9c
products:
  - Salesforce Extensions for Visual Studio Code
  - salesforcedx
---
# Retrieve Source

To retrieve metadata from the default org into your local project, use the **SFDX: Retrieve Source from Org** command. For non-source-tracked orgs, VS Code doesn’t automatically track changes to your org, so be sure to track the changes you retrieve in source control. Retrieving source from an org overwrites the local versions of the source files.

![Retrieve source from org](https://developer.salesforce.com/docs/platform/media/vscode/retrieve-source-from-org.png)

You can retrieve source for a manifest, source files, directories, or folders:

## Manifest

- In VS Code explorer or editor, right-click a manifest file and select **SFDX: Retrieve Source in Manifest from Org**.
- With a manifest file open in the editor, open the Command Palette and run **SFDX: Retrieve Source in Manifest from Org**.

## Source File or Directory

- In VS Code explorer, right-click a source file or a directory and select **SFDX: Retrieve Source from Org**.
- With a source file open in the editor, right-click in the editing pane and select **SFDX: Retrieve This Source from Org**.
- With a source file open in the editor, open the Command Palette and run **SFDX: Retrieve This Source from Org**.

When you select an item to retrieve source, only the existing nested items in the directory structure are retrieved. For example, if you retrieve source for the `classes` folder, the Apex classes that **currently exist in that directory** are retrieved. The command doesn’t retrieve all the Apex classes in the org; it updates only the classes that exist in the folder. To retrieve a new Apex class, add that class (or all Apex classes) to a `package.xml` file and retrieve the source using the manifest file. You could also use a terminal to run `sfdx force:source:retrieve --metadata ApexClass:YourApexClass`.

You can also use the Org Browser to retrieve source.

The project structure after you retrieve source:

```text
your-app
├── README.md
├── sfdx-project.json
├── .sfdx
├── .vscode
│   ├── extensions.json
│   └── settings.json
├── force-app
|   └── main
|       └── default
|           ├── aura
|           ├── classes
|           └── objects
└── manifest
    └── package.xml
```


## See Also

[Org Browser](https://developer.salesforce.com/docs/platform/sfvscode-extensions/extension-pack-features/org-browser.md)
