for example want hack on code of angularjs, clone using git clone https://github.com/angular/angular.git
, simulate update scenario, use git reset --hard head~10
discard recent commits, git pull works after reset, because can updates remote repo easily, filter-branch, git pull painful, question how deal such painfulness.
since can hack on own repo, sometime of original repo may have directory don't want, example project may have node_modules in repo, here take script folder example, should remove using filter-branch on local repo, after git filter-branch --tree-filter "rm scripts -rf"
, it's erroneous update original repo,
git pull after filter-branch, it's erroneous, , difficult manage conflicts.
so how deal repos not managed have use filter-branch remove operation, problem how update after filter-branche operation, there nice solution staff?
when use filter-branch
change commit hashes of every commit in branch. should last resort, not reach regularly.
instead, remove directory repository using like
git rm -r scripts
and commit. create new commit removing scripts directory while keeping previous commits exist.
operations "change" commits, including filter-branch
, should avoided on shared commits. these kinds of operations cause kinds of complications, of discovering now.