Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Issue in Using JGit PullCommand

Hi All,

I'm trying to use jgit PullCommand to get the functionality equal to svn update. When I use CloneCommand
, a clone of the remote repository is made in the local host. However, when I use the PullCommand, I noticed that the changes in the remote repository are not merged in to the local repository. Is there a proper java sample which shows how to use this command? I could not find such a sample in the jgit documentation as well. I have included the code sample that I used below:

private String localPath;
private Repository localRepo;
private Git git;

localPath = "/home/test/git_repo_test";
remotePath = "";

try {
    localRepo = new FileRepository(localPath + "/.git");
} catch (IOException e) {
git = new Git(localRepo);

PullCommand pullCmd = git.pull();
try {;
} catch (GitAPIException e) {

I use this code after the initial cloning, but any additional files added after the initial clone are not updated in the local repository. Please let me know what is the issue here.


Thanks and Regards,

Back to the top