Posts Tagged command line
Removing a git alias
Posted by Erik Bauffman in default on June 30, 2011
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?
Posted by Erik Bauffman in default on June 29, 2011
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
Posted by Erik Bauffman in default on June 29, 2011
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])
SSH completion
Posted by Erik Bauffman in default on June 28, 2011
I hate it when I need to type the entire host I want to connect to. So I’ve added this to my ~/.bash_profile which autocompletes the ssh command based on my ~/.ssh/config
complete -W “$(awk ‘/^\s*Host\s*/ { sub(/^\s*Host /, “”); print; }’ ~/.ssh/config)” ssh
Thanks to @janmoesen for fixing the error.
MySQL configuration file
Posted by Erik Bauffman in default on June 27, 2011
Place the configuration file ‘my.cnf’ in your home directory.

I no longer need to type ‘mysql -uroot -proot …’ to connect to my local databases. You can also set some other options such as the default character set which defaulted to latin1 in my case. I don’t like latin1, but I also don’t like typing this over and over when connection to a database.
MySQL command line import
Posted by Erik Bauffman in default on May 24, 2011
I always seem to forget the right command.
mysql -uroot -proot databaseName < /location/to/my/file.sql