Git: remove a submodule

For years, i’ve been searching the internet every time i want to do this. Various guides have come and gone. I rarely deal with git submodules anymore since the dawn of Bundler, but every now and then i find i want to remove a submodule in order to convert to bundler.

So once and for all, here’s the process, for example i am deleting a cucumber rails plugin:

Remove the three lines from .gitmodules

[submodule "vendor/plugins/cucumber"]
	path = vendor/plugins/cucumber
	url = git://github.com/cucumber/cucumber.git

Remove the two lines from .git/config

[submodule "vendor/plugins/cucumber"]
	url = git://github.com/cucumber/cucumber.git

Delete the git reference file that holds the submodule’s SHA commit id. Note the important lack of a trailing slash.

git rm --cached vendor/plugins/cucumber

Git will now see the entire directory as new files, because it’s no longer a submodule. Now you are free to delete the whole lot.

rm -rf vendor/plugins/cucumber/

And now you can add it to your Gemfile to use with bundler :)

GitHub in the Crunchies!

If you feel so inclined, you might like to vote for GitHub as the best bootstrapped startup of 2008 in the Crunchie awards.

I am extremely fond of GitHub and the joy and collaboration it has brought to programming. It is very clever and very useful!

Y GIT IZ BETTR THAN X

LOLCATZ IN UR GITHUBZ!

There is really no need for this: lol.whygitisbetterthanx.com but it is so funny!

GIT WILL ALLOW U 2 HAS MULTIPLE LOCAL BRANCHEZ DAT CAN BE ENTIRELY INDEPENDENT OV EACH OTHR AN TEH CREASHUN, MERGIN AN DELESHUN OV DOSE LINEZ OV DEVELOPMENT TAEK SECONDZ.

Aimee’s law of LOLCATS: Anything you push to GitHub will, in time, become translated into LOLCAT. This is inevitable.

P.S. I’ve just had a look on GitHub, and the page has now been translated into 11 languages. :) Sed ankoraŭ neniu estas tradukinta ĝin en Esperanton. Mi pensas, ke Esperanto devus esti la sekvontan tradukon. “Kial Git estas pli bona ol X” :)

Why Git is better

See this site: Why Git is better than ‘X’. It’s well worth a good read. It explains all the best things about Git, and compares other software configuration management systems to see how they measure up.

But that’s not the reason i’m posting. It’s more exciting than that! See those Expand all | Collapse all links? … i did that! :) The site source code is available on GitHub. I forked it, made the change, submitted a pull request. 14 minutes later it was deployed live.

Other people have been translating the site into different languages. Git and GitHub are wonderful things!

In a similar way, we had open source dinner tonight. I took Saturday’s leftover stew, forked it, added matzo dumplings, submitted a pull request, which was accepted! It was lovely dinner! :D

Update: and now i see even the US government is going open source! Everything on change.gov is now freely available for the world to copy, change and redistribute, provided they attribute the source. Nice one, Obama! :) In fact, i’m going to make use of that creative commons licence right now:

President-elect Obama has championed the creation of a more open, transparent, and participatory government. To that end, Change.gov adopted a new copyright policy this weekend. In an effort to create a vibrant and open public conversation about the Obama-Biden Transition Project, all website content now falls under the Creative Commons Attribution 3.0 License.

- Towards a 21st century government on change.gov/newsroom

Gitk on a netbook

Further to yesterday’s post, “Rails on a netbook”, i found everything went well except Gitk. The fonts were too big to be useful, and the settings dialog box was too big for me to change it. But look now:

Gitk now useable on a netbook!

(Yes, that is the MyChores repository, now cloned on to my netbook! Yey!)

I plugged into an external monitor in order to access the settings, but for anyone who does not have that option, i’ve since found out you can edit ~/.gitk configuration file. My font settings are thus:

set mainfont {helvetica 7}
set textfont {courier 6}
set uifont {helvetica 7 bold}

There are also many other settings that you could tweak if you wanted to.

Rails on a netbook?

I am here today to ask a question and then answer it. The question is: Can you run Ruby on Rails on a netbook? Specifically, an Acer Aspire One. My motivation is … since buying my netbook, i have completely fallen in love with it, and much prefer it to the desktop computer. I want to do as much as possible on the netbook. I don’t think i’d spend a whole day coding on it, but just for quick little things it could be wonderful!

Now that MyChores is open source i really like this idea of code anywhere. Wherever i have my netbook and an internet connection, i can code! If there’s an emergency bug needs fixing on MyChores, i could make the fix and push it. Or if i’m feeling lazy one Saturday morning there can surely be nothing better than a cup of coffee and coding in bed! ;)

So without further ado, let’s see if you can put Rails on a netbook …

Continue reading

Git-tastic!

A reference for myself, and possibly for future people who may want to know how to do this.

Suppose you have a Git submodule, and you checked out a branch by its SHA1 ID because it had no branch name or tag where you want it. Later you want to know which SHA1 ID you checked out.

git branch --verbose --no-abbrev

This will give you an output such as:

* (no branch) 71528b1825ce5184b23d09f923cb72f4073ce8ed Previously we only added the "lib" subdirectory to the load path when setting up gem dependencies for frozen gems. Now we add the "ext" subdirectory as well for those gems which have compiled C extensions as well. [Wincent Colaiuta]
master 6e754551254a8cc64e034163f5d0dc155b450388 Merge docrails changes

So, again for my own reference, i'd like to check out the following SHA1 IDs to use with MyChores:

Rails: 71528b1825ce5184b23d09f923cb72f4073ce8ed
Rspec: cb7ff4852331fafd1143d610ffefcdce2dd85c20
Rspec-rails: ee0fc3da63e3412d4df36c47fb2eda27127fd9d8