public RevCommit tryFastForward(RevCommit newCommit) throws IOException,GitAPIException {Ref head = getHead();ObjectId headId = head.getObjectId();if (headId == null)throw new RefNotFoundException(MessageFormat.format(JGitText.get().refNotResolved, Constants.HEAD));RevCommit headCommit = walk.lookupCommit(headId);if (walk.isMergedInto(newCommit, headCommit))return newCommit;String headName = getHeadName(head);return tryFastForward(headName, headCommit, newCommit);}