aboutsummaryrefslogtreecommitdiff
path: root/content/blog/commands/git-rewrite-commit-history.md
blob: 8378a9c18b9646ae89e107f254d3bd3df6d05125 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
---
title: "Rewrite a git commit history"
date: 2018-03-05
description: How to rewrite a git commit history
tags:
  - git
---

## git filter-branch

Here is how to rewrite a git commit history, for example to remove a file :
{{< highlight sh >}}
git filter-branch –index-filter "git rm --cached --ignore-unmatch ${file}" --prune-empty --tag-name-filter cat - -all
{{< /highlight >}}