[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [egit-dev] How to merge (programmatically) with a remote repo?
|
2011/10/10 André Dietisheim
<adietish@xxxxxxxxxx>
Hi
I currently try to merge a local repo with a remote one, but I currently fail. I'd appreciate a lot if you could gimme some pointers :)
I first init a local repo:
InitCommand init = Git.init();
init.setDirectory(repositoryFile);
init.setBare(false);
Git git = init.call();
Repository repository = git.getRepository();
and then add a remote to it:
StoredConfig config = repository.getConfig();
RemoteConfig remoteConfig = new RemoteConfig("ssh://.....", "myRemote");
remoteConfig.addURI(uri);
remoteConfig.update(config);
config.save();
and then I'd like to merge my local repo with the remote (???):
ObjectId objectId = repository.resolve(remoteName);
git.merge().include(objectId).setStrategy(MergeStrategy.OURS).call();
I fail when trying to tell the merge command to merge with the remote. I'd appreciate any points a lot.
merge is a local operation so you first need to fetch the commits you want to merge
in order to make them available to the merge operation in the local object database
--
Matthias