add page
parent
1029113802
commit
fb7dad0254
1 changed files with 33 additions and 0 deletions
33
changeGitHistroy.md
Normal file
33
changeGitHistroy.md
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# How to change the History of a git repo
|
||||||
|
|
||||||
|
This is usefull if you want to permanently delete something form a git repo
|
||||||
|
(attackers can clone the repo and revert commits which deleted files). This
|
||||||
|
Methode rewirtes the git History
|
||||||
|
|
||||||
|
Step1:
|
||||||
|
clone repo again (you might break stuff)
|
||||||
|
|
||||||
|
Step2:
|
||||||
|
install git-filter-repo
|
||||||
|
```
|
||||||
|
sudo pacman -S git-filter-repo
|
||||||
|
```
|
||||||
|
|
||||||
|
Step3:
|
||||||
|
use git-filter-repo to delete files
|
||||||
|
|
||||||
|
```
|
||||||
|
git filter-repo --invert-paths --path <path to the file or directory>
|
||||||
|
```
|
||||||
|
|
||||||
|
Step4:
|
||||||
|
add origin again
|
||||||
|
```
|
||||||
|
git remote add origin <link to repo>
|
||||||
|
```
|
||||||
|
|
||||||
|
Step5:
|
||||||
|
force push
|
||||||
|
```
|
||||||
|
git push origin --force --all
|
||||||
|
```
|
Loading…
Add table
Reference in a new issue