简体   繁体   中英

Resolve Conflicts Between Two Branches

I'm working on an application and managing its repo on bitbucket.

During the development process, I created a new branch 'price-module' a few days ago and pushed its changes in the remote branch by the same name. Now, when I'm merging 'price-module' to 'master' branch, bitbucket is showing me an error that there are conflicts between some files. (specifically in bin/R.txt). How can I resolve these conflicts and merge the changes I did in 'price-module' to 'master' branch without losing my code?

PS: the project I'm working on is an Android project.

Update: what have I tried so far to solve the problem

I did some research on my own to try and solve the conflict between files. These are the steps I took to solve the conflict:

  • Switched to master branch, manually overridden the conflicted files by copying them from 'price-module' branch (they are mainly gen or bin ), pushed them to master and then tried to merge 'price-module' into 'master' -- FAILED!
  • Added Android-specific rules in exclude file in my .git folder from this answer but the gen and bin folders kept showing up.

In an Android project, you should not be storing the bin folder in version control in the first place as it contains only generated files. Though R.txt isn't one of them, there's R.java in gen/your/package/name .

Assuming it's the generated bin folder, you should remove it from git, add it to .gitignore so it doesn't show up as non-versioned in git status, merge or re-apply the deletion to both branches, and just let the build tools generate bin files as needed.

For more things to not put in version control, see Typical .gitignore file for an Android app

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM