Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add alternative to bfg on about-large-files-on-github.md #34635

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,38 @@

### Removing a file that was added in an earlier commit

#### BFG Repo-Cleaner

If you added a file in an earlier commit, you need to remove it from the repository's history. To remove files from the repository's history, you can use the BFG Repo-Cleaner or the `git filter-repo` command. For more information see "[AUTOTITLE](/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository)."

#### git rebase

Check failure on line 111 in content/repositories/working-with-files/managing-large-files/about-large-files-on-github.md

View workflow job for this annotation

GitHub Actions / lint-content

Trailing spaces

Expected: 0 or 2; Actual: 1.

Alternatively, `git rebase` may be used to alter the commit in the earlier commit. First, you need to identify the hash of the commit where the change happened. For instance, to modify `35da8436`, you may use

```shell
$ git rebase --interactive 35da8436~
```

The tilde (`~`) is strictly necessary to reapply the subsequent commits. `git rebase` will now open an editor of structure:

```shell
pick 35da8436 style: add new resources for roofs and clean up some old ones
pick 09f6df0d feat/WIP!: major restructure and rewrite of components
```

Change `pick` to `edit` in the line of the commit to be modified. Once the file is saved, the HEAD of the repository will be at the named commit. The commit may now be modified. Repeat the steps mentioned previously:

```shell
$ git rm --cached GIANT_FILE
# Stage our giant file for removal, but leave it on disk
$ git commit --amend -CHEAD
# Amend the previous commit with your change
# Simply making a new commit won't work, as you need
# to remove the file from the unpushed history as well
```

Consequently, you may return to the original HEAD using `git rebase --continue` and push the smaller commits using `git push`.

## Distributing large binaries

If you need to distribute large files within your repository, you can create releases on {% data variables.location.product_location %}. Releases allow you to package software, release notes, and links to binary files, for other people to use. For more information, visit "[AUTOTITLE](/repositories/releasing-projects-on-github/about-releases)."
Expand Down
Loading