github - Remove directory from a Git repository, and from history, without deleting it from the local filesystem -
github - Remove directory from a Git repository, and from history, without deleting it from the local filesystem -
i'm still learning git, , did dumb thing adding directory total of many big files repo. now, remove directory git. know how utilize gitignore, , know how remove file git not local filesystem i'd take directory (and contents) out of history of repository well. see few similar questions on here, none of them seem specific situation. in particular, maintain directory untouched on local filesystem.
i should note that, new repository, have yet share other users, i'm unconcerned relates other users @ point.
there several ways remove file , directory history git:
git reset
appropriate mode (hard, soft, mixed, etc). interactive rebasing. using git filter-branch
. there perchance more methods (i need think more it). 1 utilize depends on situation.
assuming added directory git history in last, say, 15 commits, utilize interactive rebase. see
official linux kernel documentationgit rebase
pro git § 6.4 git tools - rewriting history if directory added many many commits ago (like more 100), git filter-branch
improve alternative run faster , more convenient utilize interactive rebase on hundred or more commits.
make sure create re-create of directory , contents , save temporarily outside of git project directory, before attempting remove repository history. move directory afterwards.
git github gitignore
Comments
Post a Comment