View git diff by word


By default, git diff will highlight differences by line.

Differences highlighted word by word:

$ git diff --word-diff

Differences highlighted character by character:

$ git diff --word-diff-regex=.

Differences highlighted word by word without extra characters:

$ git diff --color-words

Differences highlighted character by character without extra characters:

$ git diff --color-words=.

More information can …

more ...

Pretty printing of git commit history


Helpful git logging aliases

Helpful aliases for viewing git commit history: logg, logga, loggs, loggsa, logd, logda, logdr, and logdra.

The aliases combine to utilize the same set of flags in different combinations:

--color:show colored
--graph:text-based graphical representation of the commit history
--date-order:show no parents before all …
more ...

Safely force pushing with Git


I want to modify the most recent commit but its already been pushed to origin. Using the --force-with-lease flag I can "more safely" push to origin and overwrite the existing data.

The --force-with-lease flag checks to make sure the remote repo matches the local cache. In other words, it ensures …

more ...

Rescue a missing git stash


I lost a git stash the other day mysteriously. Here is the process I used to recover a lost stash.

Where is my Stash?

Lets assume you have a git stash:

$ git stash
Saved working directory and index state WIP on master: 1f96501 Unmark two old posts as drafts, check …
more ...

Age of git tracked file II


Identify the last time an arbitrary line (let's say line 1) was changed for every file in the repository.

Step 1

Try and use blame to identify changes to the first line only:

$ git blame -L 1,1 -- README
^193d722 (Paul Schwendenman 2012-07-23 16:51:03 +0200 1) ======================

Grab …

more ...

Age of git tracked file


I use a password store named pass. Pass is a command line based manager that attempts to follow the Unix philosophy (roughly tools should do one thing and do it well.) I wanted to know when the last time I updated each password in my store, so that I …

more ...