So I've just recently started using more of git functionality and I'm a bit lost.
I cloned the repo from
master
branch.Did some coding.
I
git checkeout -b newbranch
thengit commit
andgit push origin newbranch
I did pull request in bitbucket but it was pointing to
master
branch and I was told to point it todevelop
branch so I did. Then I got:So in my terminal i did
git checkout develop
but when I tried togit pull
I gotAlready up to date
message. So ifdevelop
branch is different thannewbranch
and it's causing conflicts why I can't pull it? What don't I understand here?
I need to get the code from develop
branch, resolve conflicts and than push it again and do pull request again.
CodePudding user response:
The conflicts you need to solve are between develop
and newbranch
.
The two main ways to fix this issue from your local repo are :
- rebase
newbranch
on top ofdevelop
# from branch 'newbranch' :
git checkout newbranch
# rebase on top of 'develop' :
git rebase develop
# if you actually need to edit or drop commits along the way, you may use
# an interactive rebase :
git rebase -i develop
- merge
develop
intonewbranch
# from branch 'newbranch' :
git checkout newbranch
# merge 'develop' :
git merge develop
Choose whichever way is adapted to your workflow.
You will need to fix conflicts to complete either of these actions -- your remote says that there are some.
Once you are satisfied with your updated newbranch
on your local repo, push it to your remote :
git push origin newbranch
# if you ran rebase, you will need to force push your branch :
git push --force-with-lease origin newbranch