Reputation: 12251
A colleague has done a few things I told them not to do:
I've then:
I want to remove this from:
I have a solution for removing something from the history, taken from Remove file from git repository (history). What I need to know is, should my colleague also go through this, and will a subsequent push remove all info from the fork? (I'd like an alternative to just destroying the fork, as I'm not sure my colleague will do this)
SOLUTION: This is the shortest way to get rid of the files:
check .git/packed-refs - my problem was that I had there a refs/remotes/origin/master line for a remote repository, delete it, otherwise git won't remove those files
(optional) git verify-pack -v .git/objects/pack/#{pack-name}.idx | sort -k 3 -n | tail -5 - to check for the largest files
(optional) git rev-list --objects --all | grep a0d770a97ff0fac0be1d777b32cc67fe69eb9a98 - to check what files those are
git filter-branch --index-filter 'git rm --cached --ignore-unmatch file_names' - to remove the file from all revisions
rm -rf .git/refs/original/ - to remove git's backup
git reflog expire --all --expire='0 days' - to expire all the loose objects
(optional) git fsck --full --unreachable - to check if there are any loose objects
git repack -A -d - repacking the pack
git prune - to finally remove those objects
Upvotes: 0
Views: 276
Reputation: 44589
Well, pushing will definitely cause little trouble as you won't have a linear history. Using --force
flag to push and pull should do the job.
Although, if not, ask your colleague to reset their branch at the first known commit git reset --hard <initial commit sha-1>
and then ask them to pull. This way should work as the reset won't properly be a change in the local branch; the branch will only be marked as behind it's remote counterpart by lots of commit. Then, fetching and merging will go easy as they'll go up all the way with a linear history.
But of course, such a manoeuvre need organization/timing between your team.
Upvotes: 1