All Projects → TimHeinrich → GitRewrite

TimHeinrich / GitRewrite

Licence: MIT license
Rewrite git history. Faster alternative to git filter-branch or bfg-repo-cleaner to perform certain rewrite tasks on a git repository.

Programming Languages

C#
18002 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to GitRewrite

parkour-game-template
A unity game template focused on movement. Including Wallrunning, sliding, vaulting etc.
Stars: ✭ 15 (-80.77%)
Mutual labels:  csharp-code
AdminToolbox
Server Administration Toolbox Plugin for SCP: Secret Lab
Stars: ✭ 17 (-78.21%)
Mutual labels:  csharp-code
Unitylibrary
📚 Library of all kind of scripts, snippets & shaders for Unity
Stars: ✭ 1,968 (+2423.08%)
Mutual labels:  csharp-code
unity-dijkstras-pathfinding
Dijkstra's Pathfinding Algorithm Unity Implementation. (Not being maintained by me, it is just an experiment.)
Stars: ✭ 80 (+2.56%)
Mutual labels:  csharp-code
CSharpNamingGuidelines
C#命名规范中文版/C#编码规范中文版
Stars: ✭ 30 (-61.54%)
Mutual labels:  csharp-code
Iron-OCR-Image-to-Text-in-CSharp
Image to Text Tutorial in C# - See https://ironsoftware.com/csharp/ocr/tutorials/how-to-read-text-from-an-image-in-csharp-net/
Stars: ✭ 65 (-16.67%)
Mutual labels:  csharp-code
CategoryTool
Unity Editor tool to create Categories in the Hierarchy. The Categories work as dividers between GameObjects.
Stars: ✭ 47 (-39.74%)
Mutual labels:  csharp-code
CockyGrabber
C# library for the collection of browser information such as cookies, logins, and more
Stars: ✭ 46 (-41.03%)
Mutual labels:  csharp-code
RawTools
RawTools is an open-source and freely available package designed to perform scan data parsing and quantification, and quality control analysis of Thermo Orbitrap raw mass spectrometer files from data-dependent acquisition experiments.
Stars: ✭ 35 (-55.13%)
Mutual labels:  csharp-code
ConfigMapFileProvider
.NET Core configuration based on Kubernetes config maps with auto reload support
Stars: ✭ 45 (-42.31%)
Mutual labels:  csharp-code
Unity3D-ReactiveScriptables
ScriptableObject based framework / scaffolding that facilitates loosely coupled communication and automatic update propagation between MonoBehaviour components.
Stars: ✭ 25 (-67.95%)
Mutual labels:  csharp-code
AnyDiff
A CSharp (C#) diff library that allows you to diff two objects and get a list of the differences back.
Stars: ✭ 80 (+2.56%)
Mutual labels:  csharp-code
LiteGui
Immediate Mode GUI From Scratch
Stars: ✭ 15 (-80.77%)
Mutual labels:  csharp-code
covidtrackerapiwrapper
CovidSharp is a crossplatform C# API wrapper for the Coronavirus tracking API (https://github.com/ExpDev07/coronavirus-tracker-api)
Stars: ✭ 11 (-85.9%)
Mutual labels:  csharp-code
ETWNetMonv3
ETWNetMonv3 is simple C# code for Monitoring TCP Network Connection via ETW & ETWProcessMon/2 is for Monitoring Process/Thread/Memory/Imageloads/TCPIP via ETW + Detection for Remote-Thread-Injection & Payload Detection by VirtualMemAlloc Events (in-memory) etc.
Stars: ✭ 32 (-58.97%)
Mutual labels:  csharp-code
MOEAs
This project is implemented by C#, and introduces a algorithm framework of MOEA, and some MOEA algorithms and multi-objective problems are provided.
Stars: ✭ 23 (-70.51%)
Mutual labels:  csharp-code
Cryptography
Some simple cryptographic examples on C# 6.0
Stars: ✭ 14 (-82.05%)
Mutual labels:  csharp-code
csharp
📚 Recursos para aprender C#
Stars: ✭ 37 (-52.56%)
Mutual labels:  csharp-code
TeeChart-for-.NET-CSharp-WPF-samples
Assorted WPF examples
Stars: ✭ 18 (-76.92%)
Mutual labels:  csharp-code
osagitfilter
Filter to put OSA languages (AppleScript, JavaScript) into git, as if they where plain text-files
Stars: ✭ 25 (-67.95%)
Mutual labels:  git-filter

GitRewrite

Rewrite git history.

Faster alternative to git filter-branch or bfg-repo-cleaner to perform certain rewrite tasks. It was tested on windows and linux.

With this tool the repository can be rewritten in a few different ways, like removing deleting files and folders, removing empty commits or rewriting committer and author information.

Docker images are available here: https://hub.docker.com/r/lightraven/git-rewrite

Build status

Important notice

This tool will rewrite the git history and therefore change many, if not all, commit hashes. It will also unsign signed commits. Only use it if you fully understand the implications of this!

Usage

Deleting files

GitRewrite C:/VCS/MyRepo -d file1,file2,file3
GitRewrite C:/VCS/MyRepo --delete-files file1,file2,file3
GitRewrite C:/VCS/MyRepo -d file1,file2,file3 --protect-refs
GitRewrite C:/VCS/MyRepo --delete-files file1,file2,file3 --protect-refs

Deleting should be pretty fast, especially when specifying the whole path to the file. Simple wildcards for the beginning and the end of the filename are supported, like *.zip. It also lets you specify the complete path to the file instead of only a file name. For this the path has to be prefixed by a forward slash and the path seperator also is a forward slash: /path/to/file.txt Specifying only files with complete path will result in much better performance as not all subtrees have to be checked.

If the goal is to delete files but keep them in all refs (branches and tags) use the --protect-refs flag. With this flag GitRewrite will not touch files in a commit a ref points to.

Deleting directories

GitRewrite -D folder1,folder2,folder3
GitRewrite --delete-directories folder1,folder2,folder3
GitRewrite -D folder1,folder2,folder3 --protect-refs
GitRewrite --delete-directories folder1,folder2,folder3 --protect-refs

Patterns and performance characteristics are the same as for deleting files. Can be used in conjunction with -d.

Remove empty commits

Another useful feature is to remove empty commits. For this tool empty commits are defined as commits that have only a single parent and the same tree as their parent. With git filter-branch this takes days for huge repositories, with GitRewrite it should only be a matter of seconds to minutes.

GitRewrite C:/VCS/MyRepo -e

This should performa really fast as each commit has to be read only once and written if a parent has changed.

Rewrite trees with duplicate entries

The main motivation for this tool was a repository where git gc complained about trees having duplicate entries. GitRewrite solves this problem by rewriting the trees by removing the duplicates, then rewriting all parent trees, commit and all following commits.

GitRewrite C:/VCS/MyRepo --fix-trees

List contributor names

Lists all authors and committers.

GitRewrite C:/VCS/MyRepo --contributor-names

Rewrite all contributor names

GitRewrite C:/VCS/MyRepo --rewrite-contributors [contributors.txt]

Rewrites authors and committers. The contributors.txt is the mapping from old contributor name to new contributor name: Old User <[email protected]> = New User <[email protected]>

General

The different actions can only be performed one at a time, for example it is not possible to mix -e and -d.

Cleanup

After a GitRewrite run files are not actually deleted from the file system. To do this you should run

git reflog expire --expire=now --all && git gc --aggressive

Instead of git gc --aggressive you might want to use something faster like git gc --prune=now, while the result may not be as good.

Important notes

GitRewrite was tested only on a few repository, so there is a big chance that it might fail for you. Please let me know of any issues or feature requests, I will update the tool when I find the time for it. Pull requests very welcome! Still searching for a way to make this even faster, maybe some parallelization options that I have not employed yet or faster file acces (while this should be pretty efficient already using memory mapped files)

Build instructions

Currently we are building with .NET Core 3.1, so the SDK should be installed.

git clone https://github.com/TimHeinrich/GitRewrite.git
cd GitRewrite
dotnet publish --self-contained -r win-x64 -c Release -p:PublishSingleFile=true GitRewrite

Icon attribution

disconnect by Dmitry Baranovskiy from the Noun Project

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].