From 3253837e6aacf40045da0ff0500f62bb0ad982d8 Mon Sep 17 00:00:00 2001 From: vincent Date: Mon, 19 Apr 2021 13:31:57 +0200 Subject: [PATCH] update git --- IT/git/Git.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/IT/git/Git.md b/IT/git/Git.md index 2ede974..661911c 100644 --- a/IT/git/Git.md +++ b/IT/git/Git.md @@ -23,8 +23,22 @@ this will ask if you want to add each modification with this option: ## delete a file from complete history be carefull can't push repo last time use +need to be in a repo with no modification -`git filter-branch --tree-filter 'rm -f passwords.txt' HEAD` +``` +git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $file" HEAD +rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune +``` + +## create a repo from other repo subfoler + +- clone the first repo +- go in this directory +- launch +``` +git filter-branch --prune-empty --subdirectory-filter "subdirectory/path" master +``` +- push in your new git repo ## changing email adress