tips & tricks

Git bash: Clear screen and show diff

I just added another little convenience command for Git Bash. This is for clearing the screen and showing the diff (changes) in your branch. I added support for a parameter so you can use it either to show all differences, show the changes for a specific file, or append some other parameter to it (see the examples below).

Here`s the code itself – append it to your .bash_profile file, then restart your git bash:

    if [ "$1" ]; then
        git diff "${1}"
        git diff

Examples of usage:

cdiff # Will clear screen and show all changes not added

cdiff --cached # Will clear screen and show changes in added files

cdiff # Wil clear and show changes for the specified file

cdiff --name-only # Will clear, then list all changed files (not added)

Viewing Linqpad scripts in VS2013

I use LINQPad all the time at, both for experimenting with C#, and for building and testing Linq queries before I import them in our projects.

As an example, I recently wrote a few scripts for fetching some data from a database, and reformatting it into JSON data which we will use as dummy-data for testing. This will not be a part of our finished project, but it’s still nice to have the script visible in Visual Studio, even if I only run it through LINQPad .

The following are a couple of tips I’ve found useful when working with .linq-files in or from within Visual Studio.

Continue reading