npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gitpseudo

v1.0.2

Published

Command line tool to pseudonymize git repositories using git-filter

Downloads

9

Readme

logo gitpseudo

Command line tool to pseudonymize git repositories using git-filter-repo

This small library provides a command line tool in order to replace author names and emails from git logs with pseudonyms.

Install

This tool requires https://github.com/newren/git-filter-repo to be installed. Please follow the instructions there.

Install with npm:

npm install --save-dev gitpseudo

or simply run with npx:

npx gitpseudo [options]

Usage

If you start the tool in the project:

npm run build
node dist/cli.js

With npx:

Usage: gitpseudo [options] [command]

The tool has the following commands:

Prepare

The prepare commands can unzip a bunch of zip files, rename folders using regular expressions and clean repository folders.

The idea behind the prepare command is to pre-process the folders, often provided by a tool such as Moodle. That is, the Git-Repositories might stem from assignments, and you want to remove all names from the repositories and the folders.

The default configuration is set for Moodle, but you can easily change it to your needs. That is, if a submission is provided using Moodle, it is usually contained in a zip file you can download from Moodle. This zip contains a folder for each student with the name of the student.

Example: For an assignment "Task X" of a course "Course", the lecturer can download a file Course-Task X-123456.zip. In this zip you will find the following structure:

John Doe_4567892_assignsubmission_file_
  + submitted files
Jane Doe 8548854_assignsubmission_file_
  + submitted files
...

The submitted files may contain a zip file with a git repository. That is, you want to perform the following steps:

  1. Unzip all zip files (including zip files inside zip files)
  2. Rename all folders with a student name (using a regular expression)
  3. Maybe clean the repository (remove all files except for the ones in the .git folder)

Note that you might want to use https://www.npmjs.com/package/ziplocalgit so that students can easily create a zip file of their local git.

For that, you an use the prepare command. The default settings match the example above. For that, you would call

gitpseudo prepare --unzip --rename --clean -d "/some/path/to/folder" -r

For more information on the command, run gitpseudo prepare --help

Rewrite

The rewrite commands uses https://github.com/newren/git-filter-repo to rewrite the git history, pseudonymizizing all names and email addresses.

In short, all names are replaced with a prefix string ('author' by default) and a serial number. All emails are replaced with the same prefix string, if a name has multiple email addresses, another serial number is used.

Unfortunately, the git-filter-repo tool always resets the git repository, i.e. if you have an empty git folder, it is populated with the latest revision. So, if you want to copy the repo later on (this is usually why you do the pseudonymization in the first place), you probably want to use the --clean option.

Example:

gitpseudo rewrite -d "/some/path/to/folder" -r --clean -w [email protected]

If not otherwise specified, the tool will create a file mailmap.txt which is used for rewriting and which can also be used later on to get the real names from the pseudo names. Do not copy that file along with the pseudonymized repository!

For more information on the command, run gitpseudo rewrite --help

Status

This library is developed on demand. It only contains features as far as needed by the author. It is basically made public in order to simplify the author's scripts. This tool is an extended TypeScript version of a script found at https://github.com/qqdp/git-pseudonymizer/blob/main/git-pseudonymizer.sh

License

This program and the accompanying materials are made available under the terms of the Eclipse Public License v. 2.0 which is available at https://www.eclipse.org/legal/epl-2.0.