---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.2
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/file-management.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/operations/file-management.md
  - href: en/sourcecraft/operations/file-management.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# Deleting, renaming, or moving a file or folder in a SourceCraft repository with Git

SourceCraft utilizes the [Git](https://git-scm.com/) version control system for repository file management. The standard process is to work with files in a local copy of the repository, then use `git` to push those changes to the remote SourceCraft repository.

For more information on working with `git`, see [this page](https://sourcecraft.dev/portal/docs/en/sourcecraft/tutorials/quickstart-git.md).

{% note tip %}

As an alternative option, you can also use the SourceCraft interface to [add files and folders directly to a repository](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/add-file-repo.md).

{% endnote %}

To delete, rename, or move a file or folder in a repository using `git`:
1. [Clone the repository](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/repo-clone.md).
1. Create a new branch for the changes and push it to the remote repository:

    ```bash
    git checkout -b new-feature
    git push -u origin new-feature
    ```

    {% note info %}

    You can also push changes directly to the `main` branch, but a safer option is to use separate branches and [pull requests](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#pr).

    {% endnote %}

1. Make changes to the file structure in your local copy of the repository: delete, rename, or move a file or folder. You can do this in any file manager, such as File Explorer in Windows or Finder in macOS.
1. Make changes to the `git` index, then commit and push the changes to the remote repository:

    ```bash
    git add .
    git commit -m "updated file structure"
    git push origin new-feature
    ```

1. [Create](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/pr-create.md) a pull request from the new branch and [merge](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/pr-work.md#merge) it into the repository's main branch.

#### Useful links {#see-also}

* [Getting started with Git](https://sourcecraft.dev/portal/docs/en/sourcecraft/tutorials/quickstart-git.md)
* [Adding a file or directory to a repository from the SourceCraft interface](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/add-file-repo.md)
* [Cloning a repository SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/repo-clone.md)
* [Creating a pull request in a SourceCraft repository](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/pr-create.md)
* [Working with pull requests in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/pr-work.md)
* [Downloading, copying, or getting a link to a raw file in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/raw-content.md)
