I know that reset can be used to backup to previous commits, but is deleting and recreating the branch a quicker and easier way to reduce the size of a branch with large files scattered throughout the commit history?
Hi @Steve Novotny,
Welcome to Atlassian Community!
Branches are just pointers to different parts of the history and removing a branch will have no effect on the size of the repository, since the history of the large files is still in it. The only way to remove large files from the history is to clear the history out. You can read more about in this KB.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm assuming if I want to back up to before the big files were pushed, I do the following:
git branch <keeper>
git reset --soft <commit id before big push>
git push --force
git merge --ff-only <keeper>
git branch -d <keeper>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks. Just to verify: this will only affect the branch I am working on; it won't affect the main branch. Is that correct?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As long as you have not merged the push to the main branch then you will be good.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.