![]() The fast-forward message likely means that the xyz branch on the remote repo cannot update the local repo's xyz branch until the local repo gets all the changes added to its master branch from the remote repo first. It sounds like the master branch on the remote repository has been changed with new commits the local repository does not have. If this is failing, it has nothing to do with the two xyz branches on remote and local repositories not being able to merge. Simple! git checkout xyzīut, the user got an error! That update did not work. If you want to merge a remote xyz branch into a local xyz branch, where both branches exist off a master branch in a remote and local repository, just select or "checkout" the local xyz branch first, then do a "pull" on the same remote branch. ![]() The answer to Push branches to Git gives me the error "! " Merge it into an existing branch xyz in my local repo? ![]() How do I pull the branch xyz from the remote server (e.g. None of these posts answers the original question! The Local User Needs to Update Both the Master Branch and the XYZ Branches Separately Then merge it into your current branch (I'll assume that's master), and fix any merge conflicts: $ git merge origin/other-branch To solve your problem, first fetch the remote branch: $ git fetch origin other-branch However, this would not be a fast-forward merge: v master For example, if you have this history tree, then merging other-branch would result in a fast-forward merge: O-O-O-O-O-O A fast-forward merge is a merge in which the head of the branch you are trying to merge into is a direct descendent of the head of the branch you want to merge. However, when pull-ing, Git will only merge other-branch if it can perform a fast-forward merge. That is, a pull is just a fetch followed by a merge. Git is basically doing this: $ git fetch origin other-branch & git merge other-branch When you do this: $ git pull origin other-branch Let's say you've checked out branch master, and you want to merge in the remote branch other-branch. That's because Git can't merge the changes from the branches into your current master. (i.But I get an error "! " and something about "non fast forward" Plus anyone who is working on same repo should delete their master branch, take git pull and create new master branch. Hence we forcefully pushed out new master branch to remote. Git push –force origin masterĪnd its done.We had to perform step 3 and 4 because git does not allows us to delete master branch from remote. The branch which was named masterTemp on my local machine is now master ![]() ![]() Now there is no master branch on my local machine.Ģ) Renamed my masterTemp branch to master And we cherry-picked all stable changes to masterTemp branch.So we landed in a situation where we wanted masterTemp branch as master branch.And Here is how we did it. And unfortunately one of the branches merged was created from an unstable branch. Several of branches were merged to master branch. While working on Git with a big team, there are chances that a situation might arise when you want to set some other branch as master branch.Recently we were in a same situation. ![]()
0 Comments
Leave a Reply. |