Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
#!ruby
pesel = ARGV[0]
puts pesel
puts pesel[2]
puts pesel[0..1]
if /^[0-9]{11}/.match(pesel)
case pesel[2].to_i # first digit of month number encodes century
when 8, 9
century = 1800