NYCPHP Meetup

NYPHP.org

[nycphp-talk] Using libgit2

Gary Mort garyamort at gmail.com
Sun Nov 24 15:51:10 EST 2013


I was wondering if anyone here has done much work with libgit2?
http://libgit2.github.com/

I've been fiddling around with Git trying to find a good "process" for lone
development.

While I really like the concepts of Gitflow, but I find for myself when I'm
just hacking on code I really don't want to spend a bunch of time creating
lots and lots of individual branches just to hack around a few small bug
fixes.

What I tend to do is setup a dev site on my local workstation to play in,
and create a couple of branches for my own use.  A "clean" upstream branch
of whatever project I am working on.  My own dev branch to use as a
starting point, and then a "dirty" branch where I will use do all my coding.

If all the changes were confined to a single directory, I can use git
subtree to extract a synthetic history of just that directory, create a new
upstream branch, merge the 2 branches and then submit a pull request from
the new branch.

However, many times a PHP web application will include multiple
directories.  IE there could be
plugin/plugin_i_changed
libs/plugins/plugin_i_changed
assets/plugins/plugin_i_changed


Git subtree doesn't handle multiple directories very well, but sparse
checkouts work very well.  I can create an empty repo, add my dev repo as a
remote, enable sparse checkout and set the filters so it only checks out
files that are in a directory that includes the string 'plugin_i_changed'
in it.  So I can checkout/merge from my dev code to get the changes, then
merge back to the clean upstream branch.

I've run across a few tools that perform almost the same functionality
written in Ruby...but I'm really getting tired of installing Ruby and
Python just to be able to use git tools that were written in them..  I
don't mind python so much, except for the whole incompatibility issues with
2.7 and 3.x...  I either need to install both versions and do some path
changes to use the correct one, or I just don't use v3 stuff.

Looking at libgit2 - the api is very nice and it's cross platform.  Since I
am always working in PHP I know that I will always have PHP 5.4 installed
and functional.

I'm curious if anyone knows of any active PHP tools already using it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20131124/035f05f0/attachment.html>


More information about the talk mailing list