Git Product home page Git Product logo

tifu's Introduction

TIFU (Today I Fucked Up)

Overview

TIFU is a tool that helps to restore commits erased by a force push on Github, Gitlab and Bitbucket.

Requirements

Python 3.5+

Installation

Just clone, install dependencies, and you're ready to go!

git clone [email protected]:c0riolis/tifu.git
cd tifu
pip3 install -r requirements.txt --user
./tifu.py --help

How to use it?

The simplest way to run the tool is to launch it with a remote as argument:

./tifu.py [email protected]:namespace/project.git

Or

./tifu.py https://github.com/namespace/project.git

It will automatically infer the API, repository name and hostname to use.

If you want to run it on your own instance of Gitlab for example, this will fail since the tool can't determine which API to use. Just specify it:

./tifu.py [email protected]:namespace/project.git --api gitlab

This is equivalent to the following command:

./tifu.py --api gitlab --host mydomain.com --repo namespace/project

You can also just connect to a specific API and select the repository interactively:

./tifu.py --api bitbucket

Which works for your own instances as well:

./tifu.py --api github --host mydomain.com

Usage

usage: tifu.py [-h] [-a] [--host HOST] [-n REPO] [remote]

positional arguments:
  remote                git remote

optional arguments:
  -h, --help            show this help message and exit
  -a , --api            API to use (github, gitlab, bitbucket)
  --host HOST           server hostname
  -r REPO, --repo REPO  repository name (namespace/project)

How does it work?

Git repository managers are usually using event systems to build users' threads. These events are accessible via APIs and are providing various pieces of information.

In this case, we are using events generated on push to get the ID of the previous HEAD and create a branch pointing to it.

Old HEAD's objects are usually still available since they are not removed until the repository is garbage collected on the server side.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.