• Stars
    star
    298
  • Rank 139,663 (Top 3 %)
  • Language
    Python
  • License
    Do What The F*ck ...
  • Created over 1 year ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Backdate a commit or range of commit to a date or range of dates.

Who controls the past, controls the future: who controls the present, controls the past. The mutability of the past is the central tenet of Ingsoc. Past events, it is argued, have no existence, but survive only in written records and in human memories. The past is whatever the records and the memories agree upon. And since the Party git is in full control of all records and in equally full control of the minds of its members, it follows that the past is whatever the Party git chooses to make it.

– Linus Torvalds, probably

git-backdate

git-backdate helps you to change the date of one or multiple commits to a new date or a range of dates.

Features

  • Understands business hours, and that you might want to have your commits placed inside or outside of them.
  • Commits are randomly distributed within the given time window, while retaining their order. No 12:34:56 for you anymore!
  • Given a single commit, git-backdate will automatically assume that you want to rebase the entire range from there to your current HEAD.
  • Sets author date and committer date so you don't have to look up how to set both of them every time you fudge a commit timestamp.
  • Python, but with near-zero dependencies (see below; only sed and date), so you can just download and run it without Python package management making you sad.

Usage

Backdate all your unpushed commits to the last three days, and only during business hours:

git backdate origin/main "3 days ago..today" --business-hours

Backdate only some commits to have happened outside of business hours:

git backdate 11abe2..3d13f 2023-07-10 --no-business-hours

Backdate only the current commit to a human readable time:

git backdate HEAD "5 hours ago"

Installation

Drop the git-backdate file somewhere in your PATH or wherever you like:

curl https://raw.githubusercontent.com/rixx/git-backdate/main/git-backdate > git-backdate
chmod +x git-backdate

The magic of git will now let you use git backdate as a command.

Requirements

git-backdate tries to only require git and Python. However, it also relies on

  • sed if you want to backdate more than the most recent commit for perfectly fine reasons, don't worry about it
  • date if you want to pass date descriptions like "last Friday" or "2 weeks ago"

… why.

I started various versions of this in uni, when I did my assignments last minute and wanted to appear as if I had my life together. I still sometimes use it like that (especially to make the 3am commits look less deranged), but there have been new and surprising use cases. Most of these have been contributed by friends and do not reflect on me, nor do they represent legal or career advice:

  • Did work things outside work hours, but don't want to nudge your workplace culture into everybody working at all times.
  • Worked an entire weekend for a client, but don't want them to get used to it and start calling you on every weekend.
  • Made some fixes during a boring meeting, but pretended to pay attention throughout.
  • Want to confuse your coworkers by making it look like you were committing code while doing a company-wide presentation.
  • <your reason here, please share with the class>

Caveats

Commit dates are part of a commit's metadata. Changing a commit's date changes its hash. You very likely only want to run git backdate on commits that you have not pushed yet, because otherwise you would have to --force push your new history. I know, I know, you're using --force-with-lease, so you won't destroy data, but your collaborators or integrations will still be somewhat miffed.

Also, obviously, use with care and compassion.

More Repositories

1

goodreads-to-sqlite

Export your (or other people's) Goodreads data to SQLite
Python
77
star
2

sticker

sticker ALL the things
59
star
3

books.rixx.de

Python
31
star
4

django-context-decorator

Django @context decorator
Python
21
star
5

city-street-orientations

Playing with OSMnx
Python
18
star
6

thread-scheduler

Schedules Twitter threads.
Python
17
star
7

dotfiles

Shell
13
star
8

ynab-downgrade

Python
12
star
9

obai

Caffeine. Sugar. Fizz. DIY.
9
star
10

ripsoup

Yet Another soup.io archiver, just in time delivery.
Python
9
star
11

pkgbuilds

Shell
9
star
12

bumf

Python
8
star
13

oulipo.py

Using python withouth an ugly, taboo fifth glyph
Python
7
star
14

netbox-plugin-cookiecutter

A plugin cookiecutter for netbox
Python
6
star
15

ansible-dehydrated

Ansible playbook to run (directly and via cronjob) dehydrated to get letsencrypt certificates
Shell
6
star
16

pretix-stretchgoals

Display the average ticket sales price over time
Python
6
star
17

ansible-nginx-base

Ansible role to install nginx with current security rules, including also an UFW rule.
5
star
18

abbr

Python
4
star
19

recipes.rixx.de

Collection of recipes, using recipemd
Python
4
star
20

scriptorium

JavaScript
4
star
21

tempus

time tracking app (CLI)
Python
4
star
22

TinyMatrix

C
3
star
23

garmin-connect

Python
3
star
24

coverageroulette

Cover those LOC, pronto.
Python
3
star
25

pretix-quota-burndown

Python
3
star
26

ootannenbaum

∞ Tannenbaum
JavaScript
3
star
27

userscripts

JavaScript
3
star
28

conception

2
star
29

antihabits

JavaScript
2
star
30

bepasty-client

Python
2
star
31

speedslides

Slide deck for DjangoCon Europe 2023
Vue
2
star
32

WebMistress

CSS
2
star
33

cottidie

Python
2
star
34

fortune.rixx.de

HTML
2
star
35

py3status-modules

My own py3status modules
Python
2
star
36

git-workshop

HTML
2
star
37

BadgesPlease

Badges Please generates badge svgs for laser thruput
JavaScript
1
star
38

electron-calendar

1
star
39

django-22-issue

Python
1
star
40

ramble

Python
1
star
41

pelican2lektor

Python
1
star
42

presentation-mastodon

A presentation on mastodon at GPN17 – https://media.ccc.de/v/gpn17-8575-mammut_statt_vogel
CSS
1
star
43

marquote-frontend

Python
1
star
44

obai-calculator

Caffeine. Sugar. Fizz. DIY. WITH NUMBERS!
CoffeeScript
1
star
45

2018.djangocon.eu

JavaScript
1
star
46

MandelBrot

Displays the Mandelbrot Set. Written in Java. Can zoom, customize colors, save pictures etc.
Java
1
star
47

tinymega-workshop

C
1
star
48

notebook-aggregator

CSS
1
star
49

ansible-abbr

Shell
1
star
50

nomr

blinry/nom, but in Rust
Rust
1
star
51

pretix-navigate

Go here to download the signed versions:
JavaScript
1
star
52

pretalx-slack

Python
1
star
53

owler

Python
1
star
54

uni-linux-architecture

TeX
1
star
55

presentation-django-admins

CSS
1
star
56

pretalx-csv-export

Python
1
star
57

mips-trig

Assembly
1
star
58

tinymegae-spi

Makefile
1
star
59

knowledge-bin

Python
1
star
60

rocketfoo

Python
1
star
61

marquote

Python
1
star
62

game-stats

Python
1
star
63

shackie

Python
1
star
64

ponysplainer

Vue
1
star
65

pretalx-json-exporter

Python
1
star
66

presentation-spuren-im-netz

Gehalten bei Jugend Hackt Ulm 2017
CSS
1
star
67

ansible-bepasty

Shell
1
star
68

esplay

Lua
1
star
69

pretix-juvare-notify

Python
1
star
70

ddino

the hackiest of hacks for a temporary dance pad
C++
1
star
71

scatterbug

JavaScript
1
star
72

cutebit-content

Python
1
star
73

media-ccc-de-relive-dl

Use youtube-dl to download all relives of a media.ccc.de event
Python
1
star
74

vorturnen

Short example scripts and snippets
Python
1
star
75

github-pr-commentator

A userscript that added conversation resolution to GitHub PRs before GitHub had this feture.
JavaScript
1
star