A branch has been rebased or reseted, and I want to get the code version of a certain commit before rebase. When I query the commit, an error will be reported
org.eclipse.jgit.errors.MissingObjectException: Missing commit b83a1c25a8a630f293fe18090cff1f9a640f0246 at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:145) at org.eclipse.jgit.revwalk.RevWalk.getCachedBytes(RevWalk.java:1164) at org.eclipse.jgit.revwalk.RevCommit.parseHeaders(RevCommit.java:151) at org.eclipse.jgit.revwalk.RevWalk.markStart(RevWalk.java:325) at org.eclipse.jgit.api.LogCommand.add(LogCommand.java:343) at org.eclipse.jgit.api.LogCommand.add(LogCommand.java:180)
This is part of my code
ObjectId objectId = git.getRepository().resolve(currentCommitId);
if (objectId == null) {
logger.error("current commitId is null ,commitId:{}", currentCommitId);
}
RevCommit currentCommit = git.log().add(objectId).setMaxCount(1).call().iterator().next();
String baseMasterCommit = "";
baseMasterCommit = this.getBaseMasterCommit(git, currentCommit, currentCommitId, baseMasterCommit);
I tried using git reflog, but after changing the server, the git reflog operation could not find any commit information.