user2784676
user2784676

Reputation: 115

Merging two branches from current Coding

I have a master branch which I always used for pushes, somehow anyday I could not push because of mismatching code and I started a new Branch B1. So I pushed at this B1 for months. But this is not a very good solution.

So I want, that the master branch will hold exact the same coding which I currently have in my Netbeans.

I don´t want to merge, because there are errors while merging. I just want exactly the same code in the master branch as it is now in my Netbeans. Or maybe I can merge both and end up with exact the same code as I have now in Netbeans.

Any ideas how to do that?

enter image description here

enter image description here

Upvotes: 0

Views: 140

Answers (2)

Jeff Puckett
Jeff Puckett

Reputation: 40861

As an alternative to resetting the branch, which can sometimes have conflicts of it's own if the working directory isn't clean, has skipped tracking files, or previously unignored files, you can force move the branch pointer.

git checkout b1
git branch -f master

Upvotes: 0

kabanus
kabanus

Reputation: 25895

If you just want the branch pointer of 'master' to move to where b1 is, and forget what you had before (I would create a backup branch where master is in any case!):

git checkout master
git reset --hard b1

To create a backup branch, before reset:

git checkout -B master_bak

then checkout master again and reset.

Upvotes: 1

Related Questions