I am working with two branches in git, named 'develop' and 'feature'. Feature is my own working branch and develop is used by the whole group. I initially cloned develop into a local repository and created the feature branch from develop:
git checkout -b feature
I made multiple edits to the feature branch, including making new files, and pushed the branch the the remote repository:
git push origin HEAD
The develop branch has undergone multiple changes by other group members since I first cloned it.
I am now trying to merge my feature branch in Bitbucket with the group develop branch. When I try to create a pull request, I get a message under the diff tab stating 'There are no changes'. Under the commit tab, I get 'no commits found'.
If I attempt to merge the develop branch into the feature branch, however, many changes and a detailed commit history are reported. Bitbucket flags all the changes I have made in the feature branch for deletion.
I have tried creating a new branch in the local repository from the develop branch, and merging my changes into this branch:
git checkout develop
git pull
git checkout -b new_branch
git merge feature
I get the message 'Already up-to-date.' and none of my changes are merged.
Can anyone suggest why my branches are failing to merge?
答案 0 :(得分:1)
我的一位同事已将我的功能分支合并到开发分支中,还原了合并,然后对开发分支进行了自己的更改。因此,删除我的更改是开发分支历史记录的一部分,并且在我尝试将功能合并到开发中时正在制定。
为了解决这个问题,我克隆了一个开发分支的干净副本,并在我的功能分支未合并之前将此分支恢复为提交。然后,我将恢复的分支合并到功能分支的本地副本中。在解决冲突并提交更改后,我能够将我的功能分支推送到远程服务器并将其合并到开发分支中。
因此,问题出现了,因为git会记录由恢复创建的更改以及合并创建的更改。