# filter-repo

Oh no! I've committed a secret to my repository, and pushed the changes!&#x20;

{% hint style="warning" %}
If you alreay pushed the changes, you might want to revoke the secret.
{% endhint %}

<details>

<summary>Can't I just amend the commit and force push?</summary>

Even if you force push, the commit will still exist somewhere in the git in remote

</details>

git-filter-repo is an add-on to git that allows you to remove secrets from your git completely. Remember that, even if we amend a commit, the commit that contains our secrets still remain in the tree. We'll need a way to remove that

{% @github-files/github-code-block url="<https://github.com/newren/git-filter-repo>" %}

Once you've installed git-filter-repo, run:

```bash
git-filter-repo --force --invert-paths --path <path-to-secret>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.nushackers.org/hackerschool/lightning-git/filter-repo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
