Skip to content

Commit

Permalink
docs: add alternative to bfg on about-large-files-on-github.md
Browse files Browse the repository at this point in the history
With all due respect, I found BFG really clunky to work with. Hence, I searched for an alternative. Credits to ZelluX (https://stackoverflow.com/a/1186549).
  • Loading branch information
MathiasBaumgartinger authored Sep 18, 2024
1 parent 667abc4 commit a22254b
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,38 @@ If the file was added with your most recent commit, and you have not pushed to {

### 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

0 comments on commit a22254b

Please sign in to comment.