rubylibgit2rugged

How do I use rugged to check if there are uncommited changes in my git repository?


How do I use rugged to check whether there are uncommitted changes in my git repo?

Much like How do I programmatically determine if there are uncommited changes?


Solution

  • Wow. This question has been dead from some time, but thought I'd throw in my 2 cents as I'm using learning/using Rugged currently.

    There's a handy method Repository#diff_workdir that exists nowadays.

    Suppose you want to compare the working directory to the last commit( the equivalent of what I think of just a plain old git diff). You can get that with this:

    repo.diff_workdir(repo.last_commit)
    

    Hope this helps someone!