JGit4MATLAB is a wrapper for JGit (http://www.eclipse.org/jgit/) in MATLAB. It is meant to be used in the MATLAB command window.
Download the full zip-file from MATLAB Central File Exchange, extract anywhere on your MATLAB path and type jgit. This will download the latest version of org.eclipse.jgit and edit your Java class path file called javaclasspath.txt in the MATLAB preferences directory, making a copy called javaclasspath.txt.JGitSaved of javaclasspath.txt if it already exists.
After this you must restart MATLAB for the changes to your MATLAB Java static class path to take effect.
Create your ssh keys using putty gen and convert them to OpenSSH format. If you set a passphrase, save it in %HOME%\.jsch-userinfo using
>> jgit saveSSHpassphrase <passphrase>
You can set and get global gitconfig name and email using
>> jgit setUserInfo <name> <email@address>
In general usage is the same as in Git. See http://git-scm.com/docs.
>> jgit <command> [<options>...] [<args>...] [--] [<args>...]
See all commands
>> jgit help
Get help for individual command
>> jgit help <command>
There are some built in aliases.
co = checkout, ci = commit, st = status, br = branch
There is no mergetool. When a conflict occurs on either pull or merge, the conflicting files will be saved as *.BASE, *.LOCAL, *.REMOTE and *.orig. Download Meld (https://code.google.com/p/meld-installer/) or P4Merge (http://www.perforce.com/product/components/perforce-visual-merge-and-diff-tools). Then use the *.BASE, *.LOCAL and *.REMOTE files to resolve the conflict and save the file using its name. As an alternative just use the Git conflict markers to resolve the conflict and save the file.
In order to mark the conflict as resolved, you must first add the file to the index. Then commit.
>> jgit add resolved-conflict-file1 ...
>> jgit commit
Unfortunately, you can not use the --all flag with commit to mark a conflict as resolved. This is a feature that I have not yet implemented issue #7 (see https://github.com/mikofski/JGit4MATLAB/issues/7).
Also there is no way to abort a merge without using the org.eclipse.jgit.api.Git reset command.
>> git = JGit.getGitAPI % get an instance of the JGit api
>> repo = git.getRepository % get an instance of the repository
>> state = repo.getRepositoryState % get the repository state
>> MERGING = org.eclipse.jgit.lib.RepositoryState.MERGING % an enumeration (a constant)
>> resetCMD = git.reset; % get a reset command object
>> HARD = javaMethod('valueOf','org.eclipse.jgit.api.ResetCommand$ResetType','HARD'); % a constant
>> if state.equals(MERGING),resetCMD.setMode(HARD).call,end % check if merging then abort
See issue #10 (https://github.com/mikofski/JGit4MATLAB/issues/10).