CadaMerx
CadaMerx

Reputation: 127

Azure DevOps - Should I merge code from origin to my branch and commit?

We have just moved to Azure DevOps and Git. We are relatively new in this area. From what we have read on MSDN:

We have an origin/main-branch, where no one is able to push their commits into. It consists of up to date codes that compiles.

Suppose I have a new feature, I create a local branch myBranch from the origin/main-branch.

I add my feature, then commit & push the branch myBranch to the repo. Then I initiate a pull request.

Upon that, it tells me that I have a conflict. I go in my VS and merge from origin/main-branch to my myBranch. I resolve the conflicts.

When I get to commit & push my changed files, I get other files that have been changed, when I didn't do any change.

My question is that should I commit & push these files also ?

Upvotes: 1

Views: 122

Answers (1)

Lu Mike
Lu Mike

Reputation: 707

Git keeps an entire history of all changes made in your repo. Generally, Git can order the changes and resolve the merge automatically according with the history as well as the relationships between commits, but if it's not clear from your history how changes to the same lines in the same files should merge, conflicts will occur. Please see this document.

May i know how did you resolve the conflicts, and did you compare the changed file with them in your main-branch or myBranch?

When I get to commit & push my changed files, I get other files that have been changed, when I didn't do any change.

The change not only includes the text content, but also inlcudes encoding format. Sometimes, we use different editor to modify the file will cause the encoding format transfer. You can compare the files with binary.

I can not say that you should commit & push these files, it is recommended to check the changes and the impact of this change.

Upvotes: 0

Related Questions