fix conflicts for git merge branch to master

How do I merge this branch to master?

thufir@dur:~/NetBeansProjects$ 
thufir@dur:~/NetBeansProjects$ git clone -b 4.GUI_loading_messages_slowly git@github.com:THUFIR/USENET.git
Cloning into USENET...
remote: Counting objects: 3782, done.
remote: Compressing objects: 100% (1274/1274), done.
remote: Total 3782 (delta 1647), reused 3613 (delta 1478)
Receiving objects: 100% (3782/3782), 388.55 KiB | 100 KiB/s, done.
Resolving deltas: 100% (1647/1647), done.
thufir@dur:~/NetBeansProjects$ 
thufir@dur:~/NetBeansProjects$ cd USENET
thufir@dur:~/NetBeansProjects/USENET$ 
thufir@dur:~/NetBeansProjects/USENET$ git branch -a
* 4.GUI_loading_messages_slowly
  remotes/origin/1.FetchBean_CLI
  remotes/origin/2.some_GUI
  remotes/origin/3.messageId__string
  remotes/origin/4.GUI_loading_messages_slowly
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
thufir@dur:~/NetBeansProjects/USENET$ 
thufir@dur:~/NetBeansProjects/USENET$ git checkout -b master remotes/origin/master
Branch master set up to track remote branch master from origin.
Switched to a new branch 'master'
thufir@dur:~/NetBeansProjects/USENET$ 
thufir@dur:~/NetBeansProjects/USENET$ git branch
  4.GUI_loading_messages_slowly
* master
thufir@dur:~/NetBeansProjects/USENET$ 
thufir@dur:~/NetBeansProjects/USENET$ git diff master 4.GUI_loading_messages_slowly 
diff --git a/src/META-INF/persistence.xml b/src/META-INF/persistence.xml
index 252f563..3cebe3d 100644
--- a/src/META-INF/persistence.xml
+++ b/src/META-INF/persistence.xml
@@ -2,8 +2,8 @@
 <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http:/
   <persistence-unit name="USENETPU" transaction-type="RESOURCE_LOCAL">
     <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-    <class>net.bounceme.dur.usenet.database.Article</class>
-    <class>net.bounceme.dur.usenet.database.Headers</class>
+    <class>net.bounceme.dur.usenet.model.Article</class>
+    <class>net.bounceme.dur.usenet.model.Newsgroup</class>
     <properties>
       <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/usenet
       <property name="javax.persistence.jdbc.password" value="password"/>
diff --git a/src/net/bounceme/dur/usenet/controller/ArticleNewsgroup.java b/src/net/bounceme
index b65737a..a9fadd2 100644
--- a/src/net/bounceme/dur/usenet/controller/ArticleNewsgroup.java
+++ b/src/net/bounceme/dur/usenet/controller/ArticleNewsgroup.java
@@ -5,8 +5,8 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.mail.Message;
 import javax.mail.MessagingException;
-import net.bounceme.dur.usenet.database.Article;
-import net.bounceme.dur.usenet.database.Headers;
+import net.bounceme.dur.usenet.model.Article;
+import net.bounceme.dur.usenet.model.Newsgroup;
 import net.bounceme.dur.usenet.model.Usenet;

thufir@dur:~/NetBeansProjects/USENET$ 
thufir@dur:~/NetBeansProjects/USENET$ git merge 4.GUI_loading_messages_slowly 
Auto-merging src/net/bounceme/dur/usenet/controller/Page.java
CONFLICT (content): Merge conflict in src/net/bounceme/dur/usenet/controller/Page.java
Auto-merging src/net/bounceme/dur/usenet/database/DatabaseUtils.java
CONFLICT (content): Merge conflict in src/net/bounceme/dur/usenet/database/DatabaseUtils.java
Auto-merging src/net/bounceme/dur/usenet/model/Usenet.java
CONFLICT (content): Merge conflict in src/net/bounceme/dur/usenet/model/Usenet.java
Automatic merge failed; fix conflicts and then commit the result.
thufir@dur:~/NetBeansProjects/USENET$ 
thufir@dur:~/NetBeansProjects/USENET$ 

It's not so much that I want to "fix" the conflicts but simply replace master with the branch. Perhaps rebase?


git checkout master
git merge GUI_loading_messages_slowly
git commit
git push

You always switch to the branch, which you want to modify. So first checking out master is correct for your case. If your merge went wrong, you can with git reset "undo" your merge.


change to the branch you want merge and type.

git merge branchname

But you should really read the basics and the documentation at first.

Tutorials

链接地址: http://www.djcxy.com/p/94810.html

上一篇: Git:改变HEAD

下一篇: 修复git合并分支到master的冲突