Reputation: 43
I did a merge between two branches, it generates some conflicts, no problem, but it generates in my visual studio a tab called "changes by stages" with a list of files, I see in some files differences between them but I cannot accept or reject the changes What does staged changes mean, why did this happen, how can I fix it?
I have tried doing git add. but add part of the codes that I don't want in my branch
Upvotes: 3
Views: 13579
Reputation: 2063
I see in some files differences between them but I cannot accept or reject the changes
Files with conflicts will be listed in a tab called "Unmerged Changes", and there you will have options to handle the conflicts. Once you handle the conflict, the file will be moved to the "Staged Changes" tab.
why did this happen, how can I fix it?
Because you requested the changes from a different branch. This list represents the files that were changed. You just need click "Commit Staged" to make those changes as part of your local branch and you won't see this list after the commit.
In case you merge a branch with 0 conflicts, then VS will auto commit all changes, and you won't see the files in "Staged Changes" at all, but you should see a message "Merge completed and committed "
Upvotes: 2
Reputation: 1324977
Switch back to command-line first and check the output of a git status
: you should see the list of files with conflicts.
You can also see those in VSCode (they are in red with a trailing (!)
to their name)
Only those files should have a way to accept "Current changes" or "Incoming changes" in VSCode editor.
Others should be staged, pending the resolution of the files with merge conflicts.
Once everything is added, the rebase can continue (git rebase --continue
).
Upvotes: 1