Tag Archives: Cli

Removing a git alias

I had an issue trying to remove a git alias I made. You can remove it by deleting that line from the configuration file, but I wanted to know how to do it using the git config command.

git config --global --unset alias.myAlias

When did I introduce a certain string?

Today I needed to know when the string ‘2.1.0‘ was introduced in my git repository. There’s a nifty way in git log you can use for this.

git log -S ’2.1.0′

Tar changed files between 2 commits

Replace [hash] with the hash of the commit. This defaults to all the changed files between the hash and HEAD.

tar zcvf “$(date +’%Y-%m-%d-%H-%M-%S’)-xmple.tgz” $(git diff –name-only [hash])

You can also update the commit range by using two hashes separated with 2 dots.

tar zcvf “$(date +’%Y-%m-%d-%H-%M’)-xmple.tgz” $(git diff –name-only [hash]..[hash2])

MySQL command line import

I always seem to forget the right command.

mysql -uroot -proot databaseName < /location/to/my/file.sql