version control - Can I work with my repository during git filter-branch -


i checked in big binary files git repository. noticed got slow. 4-5 seconds respond git status . in root directory. decided clean repository git filter-branch --tree-filter "rm -f web/libs/*.*jar" head , similar commands. take hours complete.

can still work repository, while commands running?

don't try work in repository during filter-branch

you possibly continue working in repo during filter-branch sending filter-branch process background of shell session, or open terminal , continue working repo way, but highly recommend against that, cause lot of problems in repo if tried.

then again, git might lock files during filter-branch (such index), might throw bunch of errors if tried non-filter-branch operations during filter-branch anyways.

solution 1: use index-filter

don't use tree-filter this, you've seen, it's slow, because has checkout each commit working copy. use index-filter instead, recommended in filter-branch documentation, because doesn't need checkout each commit, runs faster:

git filter-branch --index-filter '   git rm --cached --ignore-unmatch web/libs/*.*jar ' head 

you can speed filter-branch passing range of commits leading head, instead of filtering of commits. example, following filter last 20 or 21 commits:

git filter-branch --index-filter '   git rm --cached --ignore-unmatch web/libs/*.*jar ' head~20..head 

documentation

the options:

--index-filter <command> 

this filter rewriting index. similar tree filter not check out tree, makes faster. used git rm --cached --ignore-unmatch ..., see examples below. hairy cases, see git-update-index(1).

the example:

using --index-filter git rm yields faster version. using rm filename, git rm --cached filename fail if file absent tree of commit. if want "completely forget" file, not matter when entered history, add --ignore-unmatch:

git filter-branch --index-filter '   git rm --cached --ignore-unmatch filename ' head 

solution 2: use bfg

or try using bfg tool, as vonc recommended.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -