You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
Repository.mergeBranches creates dirty index after a non-conflicting merge #1217
The code below produces a merge and a commit with message "Merged master into dev".
But then when i'm doing a git status i'm getting :
On branch dev
Your branch is ahead of 'origin/dev' by 156 commits.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: .gitignore
modified: license.txt
modified: readme.html
modified: wp-activate.php
modified: wp-admin/about.php
modified: wp-admin/admin-ajax.php
.....
which is odd since the merge produced earlier has the files committed.
I'm using the code below to fetch origin and merge the two branches.
@raqqun I suppose you could try working around the problem by switching your HEAD to point elsewhere and/or by performing a hard reset after the merge.
I am having this same problem; if I merge a branch into master, the merge works (the commit is there, and it is appropriate). After the merge, git status shows that I have uncommitted (but staged) changes; these changes would undo the previous commit. The problem with a hard reset after the merge is that it might clobber other staged (but uncommitted) changes. I need to play around with git itself to see what it does in this situation.
I'll try moving HEAD around and see what that does.
I had a similar issue. In my case the issue was that I fetched refs/heads/master:refs/heads/master instead of refs/heads/master:refs/remotes/origin/master.
Activity
raqqun commentedon Feb 18, 2017
Unfortunately i'm having the exact same problem.
The code below produces a merge and a commit with message "Merged master into dev".
But then when i'm doing a
git statusi'm getting :which is odd since the merge produced earlier has the files committed.
I'm using the code below to fetch origin and merge the two branches.
rcjsuen commentedon Feb 19, 2017
@raqqun I suppose you could try working around the problem by switching your
HEADto point elsewhere and/or by performing a hard reset after the merge.neloe commentedon May 17, 2017
I am having this same problem; if I merge a branch into master, the merge works (the commit is there, and it is appropriate). After the merge, git status shows that I have uncommitted (but staged) changes; these changes would undo the previous commit. The problem with a hard reset after the merge is that it might clobber other staged (but uncommitted) changes. I need to play around with git itself to see what it does in this situation.
I'll try moving HEAD around and see what that does.
This is snippets of the code that's exhibiting this behavior (with the reset in there). Unfortunately, this clobbers my staged and/or unstaged changes from already tracked files.
https://gist.github.com/neloe/cb486f73d73a34f7e890d7c827483c54
Nard-Dog commentedon Jun 1, 2017
Seeing the same issue with nodegit v0.19.0 and git v2.6.2
Steps to reproduce:
Expected:
git status should show that I have a clean index and no staged changes.
Actual:
git status reads that I have staged changes which would negate the ones I just committed.
kryp71c commentedon Sep 21, 2017
I had a similar issue. What worked for me was using the example from https://github.com/nodegit/nodegit/blob/master/examples/add-and-commit.js
which adds a couple of steps between writeTree and createCommit:
lal12 commentedon Nov 22, 2021
I had a similar issue. In my case the issue was that I fetched
refs/heads/master:refs/heads/masterinstead ofrefs/heads/master:refs/remotes/origin/master.