Purging files from Git history

2016-10-14 16:01:00 +0000

Most developers, like me, use Git for versioning. Even for personal projects, it’s great to have a history of files available. Deleting a file in git will cause it to remove from your working directory, while the file is still present in the history. Usually this is what you want, but sometimes you might want to remove a file completely including it’s history.

There’s a command for that but typically for git it’s not exactly intuitive. To alter history, you can use the filter-branch command. Filter branch can be supplied with a filter, which is a shell command that’s executed on each commit.

  • To purge a file from history, as if it never existed execute:

    git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch MYFILE public' HEAD

    Where you can replace MYFILE with one or more files you want to delete.

  • If you want to purge a whole directory, including it’s content, add the -r switch:

    git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch MYDIRECTORY public' HEAD

Great if you checked in a large file, or file in a public repository that shouldn’t be public. For more information, read the git manual or the numerous tutorials that exist. For example, git-filter can also be used to move a file from one repository to another while preserving history.

Read more

Cobol in nodejs

2016-08-29 10:35:00 +0000

Cobol can be compiled into Javascript and you can call Javascript from Cobol, as I read in this article on arstechnica. Will this finally be the way out for all legacy Cobol code?

// Dependencies
var Cobol = require("cobol");

When .Net came out early 2000s, a Cobol compiler was offered too. There a also numerous way for interoperability from Cobol to Java as well. Both didn’t succeed in cornering and replacing Cobol as far as I know. Maybe Cobol in Nodejs will.

Some things that could help:

  • Javascript is not plagued too much by enterprise architecture and requirements engineering thinking, bringing SOA, star diagrams, layers, foundations and all sort of antropomorphism This can avoid a huge amount of waste in, where organizations could spend a year building up a SOA-bus instead of doing anything - resulting in the legacy Cobol system still to the heavy lifting.
  • The hackish nature of Javascript can be troublesome, but also introduced a practical approach to dealing with legacy code. Not just rewriting everything, but just copy&paste what you need, and add functionality when it’s useful.
  • In both .Net and even more in the Java / JVM world there’s a belief that eventually everything has to run in the Virtual Machine, as bytecode, or as .Net intermediate code. Both environments have excellent ways to interoperate with ‘native’ libraries written in C, but that’s less popular. In the Node.js world this quite a common way of working.

Read more


subscribe via RSS