me on blogging RSS

Archive

Feb
26th
2010
Fri
permalink

backup backup backup

I’ve gone through many variations of my backup strategy since I started storing things digitally. Here is my current setup…

  • The master copy is stored on my iMac’s local disk.
  • Everything except music and dvds are synced with dropbox.
  • Everything is one way synced to external drive 1 via chronosync nightly.
  • External drive 1 is cloned to external drive 2 via superduper weekly.

I just recently switched my offsite backup from s3/jungledisk to dropbox. Dropbox is significantly faster at uploading (at least at my house). Dropbox does this cool thing where if you try to upload a file that is already on their system it won’t actually push the bits, instead it will point to the existing copy or make a duplicate internally at dropbox (not sure what actually happens, but it doesn’t matter the point is that you don’t have to upload that file). The dropbox clients are faster at syncing between machines when compared to jungledisk’s sync feature.

The one way sync (nothing is deleted) with chronosync is an important piece since if you delete something on one dropboxed client then that deletion is instantly propagated everywhere. So if you decide you don’t want something on one machine and you delete it then it gets deleted on every machine that is using dropbox. Dropbox will soon come with selective sync which I am anxiously awaiting.

The superduper clone is just a last chance backup incase of disk failures.

I’m sure this setup will change again, but I’m pretty happy with it for now.

Comments (View)
Jan
29th
2010
Fri
permalink

changing git commit messages

Changing your last commit message in a git repository is fairly trivial

git commit --amend -m "some other message"

but what if you’ve made several commits and want to change a message that’s not the last one? An interactive rebase is one way to do this. First find the commit just before the message you want to change

~/Work/repo (master) $ git lg
* 6119426 - (master) third commit (3 seconds ago by Darrin Holst)
* b6a0a9f - second commit (23 seconds ago by Darrin Holst)
* e24b57d - first commit (37 seconds ago by Darrin Holst)

Then start the interactive rebase

~/Work/repo (master) $ git rebase --interactive e24b57d

Which will open up your editor with…

pick b6a0a9f second commit
pick 6119426 third commit

# Rebase e24b57d..6119426 onto e24b57d
#
# Commands:
#  p, pick = use commit
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#

Change “pick” to “edit” for those that you want to edit and save that file

edit b6a0a9f second commit
pick 6119426 third commit

# Rebase e24b57d..6119426 onto e24b57d
#
# Commands:
#  p, pick = use commit
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#

Now amend that commit

~/Work/repo (master) $ git commit --amend -m "some other message"

Then continue the rebase

~/Work/repo (master) $ git rebase --continue
~/Work/repo (master) $ git lg
* cec3fba - (master) third commit (2 seconds ago by Darrin Holst)
* c146f90 - some other message (29 seconds ago by Darrin Holst)
* e24b57d - first commit (5 minutes ago by Darrin Holst)

Congratulations, you have just changed history, but remember all the same rules apply for rebasing commits that you’ve pushed to a public repository (hint - don’t do it)

Thanks to @rubbish and @developernotes for the info

Comments (View)
Nov
5th
2009
Thu
permalink

git add…all of it damn it

So we all know that git add . will add all new and modified files to the index. What about the 50 files you deleted that you also want to stage? git rm 50 times? How about adding the -u option to git add which will stage modified files and also deleted files? The one problem with that is it doesn’t add new files. So if you want to stage all new files, modified files, and deleted files then you’re forced to git add . && git add -u. We can wrap that up into an alias to save some keystrokes…

git config --global alias.ad '!git add . && git add -u'

Now just use git ad and everything will be ready to commit

Comments (View)
Sep
23rd
2009
Wed
permalink

TextMate not finding your gems?

If you’ve built ruby yourself and stuck it in /usr/local/bin you may run into a problem where textmate is using the pre-installed version of ruby. That will result in searching for gems in the pre-installed location (wherever that is)

To fix this add a shell variable called TM_RUBY in the advanced preferences of TM pointing to /usr/local/bin/ruby

Comments (View)
permalink

track git remote branch (note to self)

git config branch.master.remote origin
git config branch.master.merge refs/heads/master

Comments (View)
Sep
15th
2009
Tue
permalink

Eclipse vs. IntelliJ

I’ve been a looong time eclipse user and have tried intellij off and on over that time. I never really got hooked on intellij like some people I know…until recently. I’m not sure why it stuck with me this time, but this post will serve as my list that I can point people to when I get asked “the question”

IntelliJ - The Good

  • Selectable color themes (absolute pain in eclipse)
  • Maven works out of the box
  • better plugin manager
  • better ruby support (which gives me cucumber syntax highlighting)
  • when extracting methods, variables, etc. just put your cursor anywhere on the expression and pick which one you want if there are multiple (eclipse has to have the exact expression highlighted)

Not too much for now, but I’ll add to it as thing come to me.

Comments (View)
Aug
15th
2009
Sat
permalink

git integration not working in textmate?

So you installed projectplus or the git bundle for textmate and it doesn’t work? Try setting a TM_GIT shell variable (located in the advanced properties) to /usr/local/git/bin/git.

Comments (View)
Aug
13th
2009
Thu
permalink

svn:externals in git?

For all the benefits git has over svn, I found one thing that I was missing…svn:externals. There are a few suggesstions that you come across when searching around on this topic, one being git subprojects and another being git submodules.

I couldn’t find (read lost desire) a whole lot on subprojects, but from what I got out of it is you just do a git clone of your external project in whatever directory of your project. I tried that, committed, and pushed, but when I cloned it back just the directory was there…no files. Granted, I didn’t spend a lot of time on this, but if it were as easy as clone, commit, push then I guess everyone would be using it.

Git submodules are a little more involved and require extra commands after a clone…git submodule update. Also, these modules are bound to a specific commit where I wanted the latest (like how svn:externals work). Too much work.

So it appears, unless I’m missing something, that git doesn’t have a 100% replacement for svn:externals.

In my case I don’t care about the history of the external repo being in my repo, I just want the latest in there. Also, the external repo I need is relatively small so duplication between repos is not an issue. Finally, I don’t need to change or push to the external repo from the local one.

So I ended up with a sync job that runs every hour that looks like this…

#!sh

function sync_project() {
rm -rf $1
git clone ssh://git-server/$1.git
cd $1
rm -rf local/path/external-project
 mkdir -p local/path
 cp -R ../external-project local/path
 rm -rf `/bin/find . -type d -name .svn`
git add .
git add -u
git commit -m "auto sync"
git push origin master
cd ..
}

rm -rf external-project
svn co http://svn/external-project
sync_project "my-project"
sync_project "my-other-project"

You’ll notice that my external project comes from svn, this can easily be replaced with whatever scm it’s in.

Comments (View)
Aug
12th
2009
Wed
permalink

git pull with uncommitted files

Suppose for whatever reason you need to pull in changes from a remote repository and you have uncommitted files that you don’t want to commit. Git won’t let you do that if it needs to merge changes to one of your uncommitted files. Try this…

git stash

git pull

git stash pop

Comments (View)