修复git合并分支到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$ 

这不是我想要“修复”冲突,而是简单地用分支替换主人。 也许rebase?


git checkout master
git merge GUI_loading_messages_slowly
git commit
git push

您始终切换到您要修改的分支。 所以首先检查一下你的情况是否正确。 如果你的合并出错了,你可以用git重置“撤消”你的合并。


转到您要合并和键入的分支。

git merge branchname

但你应该首先阅读基础知识和文档。

教程

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

上一篇: fix conflicts for git merge branch to master

下一篇: Why would one use "git merge