I hope I can express this properly... I have the following setup in Bitbucket (using Git protocol). I have a master repo that contains my application. I then fork the master repo per client in order to have the flexibility to make client specific changes without affecting the master. When a generic change is required, I push to master, and then sync with the fork and then do a pull into production.
The issue I'm having is that in Bitbucket, it's saying I have merge conflicts, but I have no clue how to resolve them. Locally, I have no conflicts. When I go into Bitbucket, it tells me I'm 2 commits behind the master repo so I click sync. It says there's merge conflicts, and I need to resolve them. I then see no way to resolve these conflicts. If I do a pull on the production server, it says there's conflicts and I need to resolve them, so I do. I go in with nano (as I HATE VIM) and clean out what I need to, and go about my business. But yet the forked repo seems to still be in conflict. I have no clue what I need to do in order to resolve this situation. Regardless, it has me at a standstill because I can't push any more changes to the fork until the conflicts get resolved.
When working with a fork, it is often helpful to have the upstream repository (your Master repository) configured as a remote as well as the fork (your Client A repository). For example, you probably already have an origin
that represents the fork.
Add a new remote upstream
to represent the "Master" repository:
git remote add upstream [email protected]:user/master-repo.git
git fetch upstream
Now you should be able to see all of the relevant branches. For instance, if you're trying to merge the master
branch, these will be relevant:
master
(local)origin/master
(Client A)upstream/master
(Master repo)If you visualize these branches with gitk
or git log --all --graph --decorate
you will probably be able to see where the conflict is coming from. Most likely you will want to merge changes from both remotes into your local master
branch:
git checkout master
git merge upstream/master # (Merge changes from the "Master" repo)
# Fix any merge conflicts that may arise
git merge origin/master # (Merge changes from the Client A repo)
# Fix any merge conflicts that may arise
Once you have done this, you should be able to push
cleanly to origin
:
git push origin master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With