Sunday, May 29, 2011

Git Support in Komodo Edit.

Been awhile since I posted in here. Thanks for sticking around.

First here is the link to the GitHub Project

I have some great news. I have finally been getting around to updating all of my code and getting it into public source control, namely GitHub. The other day I moved over the youtube api files (as well as updated them). Check the original blog post for links to that repo if you are interested.

All this updating and source control got me thinking that I should make some Git Komodo Edit tools just like the subversion tools. This task wasn't too difficult as git and svn aren't that different from each other. I will outline them for you.

First is "Git Add All New". It's purpose is to add any new files you created to your repository. It is worth noting that adding != committing. When you add a file to git you are simply telling it to put that file into source control on the next commit. This is exactly the same way the subversion control works.

Next is "Git Checkout" which as you might expect is for checking out (git calls it cloning) a repository. One thing to note here, you need to have a komodo project already open otherwise the files will be checked out into your root directory instead of a projects root directory.

"Git Commit" is what makes all the magic happen it will commit all of your changed files and add any new files to the repository.

"Git Diff" will diff the currently viewed file with the version of that file stored in the repository. The output is the standard console diff format so if you aren't real familiar with that you might have some trouble spotting changes.

"Git Init" will create a new empty repository in the root of the currently active project.

"Git Push Remote" lets you push your local repository changes out to a remote repo like GitHub.

Finally there is "Git Update" which updates your project files with the most current version stored in the repository.

While I was working on the "Git Diff" tool I realized that the same tool could be created for my subversion tools so I went ahead and took the liberty of creating that.

"Subversion Diff" diffs the currently viewed file with the version that is stored in the repository. Again it uses the standard console diff syntax.

There you have it all those tools seem to work correctly for me if you have any difficulties let me know in the comments.

Here is the link to the GitHub Project

As a side note since this stuff is now in GitHub I wont be hosting it in drop box.


  1. Jim thanks for this. I'd love to get this working since it's the sole feature I need from the otherwise very expensive Komodo IDE :)

    Installed the tools from the Toolbox, all fine. Run any of them and I get e.g.

    `git pull` returned 127. /bin/sh: git: command not found

    Which is odd because I have '/usr/local/git/bin' in my $PATH. I can happily 'git' from any directory in Terminal without providing additional paths.

    So the question is what's different about it being called from within Komodo than when I have a Terminal as myself.

    Any ideas?

  2. I can't really comment about Komodo IDE as I use Komodo Edit.

    If you open preferences in Komodo Edit there is an "Environment" category with a PATH value perhaps you need to update that.

  3. I have my git binary stored in the same location but I made a soft link to it in /usr/local/bin as well. So if updating the PATH value in Komodo IDE doesn't work try linking the git binaries in /usr/local/bin

  4. Your Tools actually work in 'IDE' the same as 'Edit', though it's 'Edit' I'm now using and will continue to use (because it's free)

    Your suspicion was right that the PATH env variable wasn't being set for Komodo to find 'git'. This is extremely weird because I've set 'PATH' every place imaginable from .profile to ~/.MacOSX/environment.plist. Komodo seems never to pick up the modified path.

    As you say luckily it has its own feature to provide a user over-ride env variables it's relying on. So I add '/usr/local/git/bin' to 'PATH' inside Komodo Edit and things start to improve.

    Still can't clone (destination path 'maingit' already exists and is not an empty directory.) or pull (not a command), but working on that.

  5. The 'git pull' problem is that the Mac OS X installer from *does not include 'git pull'*. However 'git fetch' is available, so I'm going to try and modify your commands to fit.

    The root of the other problems was the Komodo .komodoproject file not being in the same directory as the .git (was giving 'not a git repository'). This was true even after setting a 'project root'.

    I'm going to see where this leaves me and will post here anything I conclude.

  6. Interesting, I am using version (the current is 1.7.6 and I have "git pull".

    Is pull being fazed out? I will update the tools if pull is no longer a valid command. Any thoughts?

  7. I should reword what I was saying. I DO NOT have a git-pull binary however I can issue the git pull command. Does git pull work in terminal?

    Also I have OSX 10.6.8

  8. I updated the update (git pull) tool. You now need to specify a repo to pull from. See if that fixes your issues.

  9. Apologies. The problem

    `git pull` returned 127. /bin/sh: git: command not found

    is caused by an incorrect GIT_EXEC_PATH. I had that pointed to /usr/local/git/bin, which is where a file called 'git' resides (which is a symlink to 'git-receive').

    When I set GIT_EXEC_PATH to 'usr/local/git/libexec/git-core I can use 'git pull'.

    What a mess I've gotten myself into! Your assistance much appreciated.

  10. Many thanks for sharing that!
    Since I am working in multi projekts having the comodo project outside of my gits I prefered to use %D instead of %p but besides that - perfekt!

    Thank you

  11. I prefer to use Codelobster
    It supports almost all source control systems.