How to remove a file from Git history

Today I learned how to remove a file from a git repository while also cleaning it from the history. When you delete it with git rm or git rm --cached, tracks remain in the commit history (the reflog). That might not be a big deal, but if the file has sensitive contents that you want to disappear from version control entirely, then you also want it cleaned from the reflog. That’s when git filter-branch comes to the rescue....

July 30, 2021

Git Worktree vs Git Savepoints

The official Git documentation presents the following example as a valid use-case for the worktree command: You are in the middle of a refactoring session and your boss comes in and demands that you fix something immediately. You might typically use git-stash1 to store your changes away temporarily. However, your working tree is in such a state of disarray (with new, moved, and removed files and other bits and pieces strewn around) that you don’t want to risk disturbing any of it....

April 29, 2021

How to add an empty directory to a Git repository

How do you add an empty directory to a Git repository? It’s a classic, and yet, I have to look it up every single time. Git does not support this out of the box: Currently the design of the Git index (staging area) only permits files to be listed, and nobody competent enough to make the change to allow empty directories has cared enough about this situation to remedy it. Directories are added automatically when adding files inside them....

March 22, 2021

How to handle big repositories with git

git is a fantastic choice for tracking the evolution of your code base and to collaborate efficiently with your peers. But what happens when the repository you want to track is really huge? via How to handle big repositories with git – Atlassian Blogs.

June 11, 2014 · Nicola Iarocci

Pro Git Workflow

Pro Git Workflow is an interesting collection of Git shortcuts, aliases and workflows. Nothing really new but give it a shot if you want to improve your git-fu beyond basics.

January 27, 2014 · Nicola Iarocci

On undoing, fixing, or removing commits in git

This document is an attempt to be a fairly comprehensive guide to recovering from what you did not mean to do when using git. via On undoing, fixing, or removing commits in git.

January 16, 2014 · Nicola Iarocci

Come annullare una Commit in Git

Usando Git capita ogni tanto, vuoi per stanchezza o per distrazione, di lanciare commit sbagliate. Stamattina m’è capitato di sistemare del codice, testarlo e fare la commit… solo per scoprire di aver lavorato sulla branch sbagliata! Non è la prima volta che mi succede e non sarà nemmeno l’ultima. Poiché ho scarsa memoria ogni volta mi tocca usare google e ripescare quei due o tre comandi utili in questi casi. Ho pensato di appuntarli qui, un po’ per metterli a disposizione di tutti, un po’ per poterli ritrovare facilmente. ...

May 17, 2012 · Nicola Iarocci

Git si è rifatto il look (e non solo)

Il sito del progetto Git è stato finalmente aggiornato. Nuova grafica, nuovo logo, ottimizzazione dei contenuti e soprattutto integrazione di importanti risorse prima ospitate altrove: la Git Reference, il libro ProGit, Why Git is Better Than X e il nuovo progetto Git Video Series, che include quattro bei filmati già pronti.

May 8, 2012 · Nicola Iarocci

Imparare Git un passo alla volta con Git Immersion

Già sapete che Git è uno degli strumenti senza i quali non potrei più vivere, ne ho scritto anche recentemente in Branching di successo per Git e Usare Git con Dropbox. Oggi vi propongo Git Immersion, fantastico sito-laboratorio per “immergersi” in Git imparandolo passo dopo passo. Git Immersion è un tour guidato che ti accompagna in una passeggiata tra i fondamenti di Git, ispirato dalla premessa che conoscere una cosa significa usarla....

April 13, 2012 · Nicola Iarocci

Usare Git con Dropbox

Usare Dropbox come repository Git remoto Recentemente, più che altro per curiosità, ho giocato con una terza opzione: Dropbox. Per me Dropbox è uno strumento indispensabile sia per il lavoro che per le mie cose personali. Su qualunque computer io sia, ovunque mi trovi, grazie a Dropbox ho accesso al mio materiale. Dunque, mi son detto, perché non usarlo anche per il codice, pur senza rinunciare al controllo versione offerto da Git? Ebbene ho scoperto che non solo è possibile, è anche molto semplice. In realtà non c’è nulla di nuovo in quel che vi mostro, la ‘magia’ la fa tutta Dropbox. ...

March 17, 2012 · Nicola Iarocci