-
Notifications
You must be signed in to change notification settings - Fork 699
Closed
Description
Hi
Firstly, thanks for good work.
Is there a chance to provide by you PULL example (git fetch followed by git merge FETCH_HEAD) or can you help me how should I change below code to achieve "git merge FETCH_HEAD"?
I used your fetch example and it worked, my repo is in this stage:
"Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
nothing to commit, working directory clean"
I won't have any changes in repository in future and don't have now, so I'm looking for method that won't create commit and won't force me to push 'merge commit'.
I was trying to modify your merge-cleanly example, but it creates commit, so it's not perfect for me (BTW don't know if this correct, because source tree shows history strange, maybe something with date of commit 1973-11-29)
var repo;
var localReference, ourCommit;
var remoteReference, theirCommit;
var ourSignature = nodegit.Signature.create("user test", "user@test.com", 123456789, 60);
Repository.open("master")
.then(function(repository) {
repo = repository;
return repo.getReference('refs/remotes/origin/master');
}).then(function(reference) {
console.log(reference.target());
remoteReference = reference;
return repo.getReference('refs/heads/master');
}).then(function(reference) {
console.log(reference.target());
localReference = reference;
return repo.getCommit(localReference.target());
}).then(function(commit) {
ourCommit = commit;
return repo.getCommit(remoteReference.target());
}).then(function(commit) {
theirCommit = commit;
return Merge.commits(repo, ourCommit, theirCommit);
}).then(function(index) {
if (!index.hasConflicts()) {
index.write();
return index.writeTreeTo(repo);
}
}).then(function(oid) {
return repo.createCommit('refs/heads/master', ourSignature, ourSignature, 'we merged their commit', oid, [ourCommit, theirCommit]);
})
.done(function(commitId) {
console.log('New Commit: ', commitId);
console.log("It worked!");
},
function() {
console.log("It failed :( !");
});Thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels