github / docs

The open-source repo for docs.github.com
https://docs.github.com
Creative Commons Attribution 4.0 International
16.24k stars 59.66k forks source link

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

Open MathiasBaumgartinger opened 1 week ago

MathiasBaumgartinger commented 1 week ago

Code of Conduct

What article on docs.github.com is affected?

https://github.com/github/docs/blob/main/content%2Frepositories%2Fworking-with-files%2Fmanaging-large-files%2Fabout-large-files-on-github.md

What part(s) of the article would you like to see updated?

As mentioned in my PRQ I think for many use-cases, with all due respect, BFG is an overloaded and unintuitive tool. Removing a file can be done rather straightforward with an interactive rebase.

As a clumsy git(hub) user I would have appreciated the suggestion for such a solution a lot.

Additional information

Content of Pull-Request

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

$ git rebase --interactive 35da8436~

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

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:

   $ 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.

welcome[bot] commented 1 week ago

Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

nguyenalex836 commented 1 week ago

@MathiasBaumgartinger Thank you for raising this issue! I'll get this triaged for review :sparkles: Our SME team will provide feedback regarding the best next steps for this issue - thanks for your patience! 💛

github-actions[bot] commented 1 week ago

Thanks for opening an issue! We've triaged this issue for technical review by a subject matter expert :eyes: