Omkar Patil

10/07/2022, 11:11 AM
Hello Everyone!! I want to store JSON file in LakeFS repo and want to do versioning of it. I was able to consume LakeFS API with Java Client to insert the object into repo. Now I want to the versioning of my file. How can I do that? Can anyone provide me some guidance on that?
Yoni Augarten

Yoni Augarten

10/07/2022, 11:28 AM
Hey @Omkar Patil, sure! Once you've added an object to a branch, it is in an uncommitted state. Once you perform a commit, a new "snapshot" is saved into the branch's history, containing the file in its current version. So your next step is to perform a commit on the branch. Here is an example of how to do it:
CommitsApi commitsApi = new CommitsApi(client);
    CommitCreation commitCreation = new CommitCreation().message("my first commit");
    Commit result = apiInstance.commit("example-repo", "main", commitCreation, null);
11:29 AM
After the commit is done, you can see it in the branch history. Use the lakeFS UI to get an idea of what the history looks like.