Does JGit API have all Git commands

こ雲淡風輕ζ 提交于 2019-12-06 15:08:06

There is no ready-to run counterpart for git remote and am in JGit, but it should be possible to implement (a subset of) them with reasonable effort.

Those sub-commands of git remote that query or manipulate the config file can be emulated by directly accessing the repository configuration through Repository.getConfig().

To clean stale remote-tracking branches like git remote prune does, you can use LsRemoteCommand to obtain a list of existing remote branches and remove remotes from the local configuration that do not match that list.

Replacing git am might be a little more effort. There is an ApplyCommand to apply a patch from a given input stream as well as the low-level Patch class to parse diffs. What would be left is to parse the mailbox files and produce a commit from the contained diffs and meta-data (message, author, etc.).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!