将提交完全拉入另一个分支(不合并)

时间:2015-07-05 14:10:13

标签: git git-branch git-merge git-pull git-fetch

我的结构与下面类似:

C1 -- C2  --  C3
               \ -- C4

我想在C3之上拉C4。 ( NB:C3& C3a按住保存文件

C1 -- C2  --  C3
               \ -- C4 -- C3a

如果我尝试合并或拉动我只是被告知我已经更新了。

我如何强制重新合并'这样我就可以让C3重回去了?

2 个答案:

答案 0 :(得分:1)

如果我理解正确,您可以使用git cherry-pick.container img:not(.two) { -webkit-filter: grayscale(100%); filter: grayscale(100%); } 提交移到C3

的顶部

答案 1 :(得分:1)

在你目前的分支机构中,我不认为你可以这样做,因为C3已经在分支机构中合并。

您可以尝试在新分支上尝试提取,这应该会产生预期的结果:

  1. 首先,创建新分支:

    MessageBox.Show("The File is Create in The Place Of The Programe If you Don't Write The Place Of copy And You write Only Name Of Folder");// It Is To Help The User TO Know
              if (Fromtb.Text=="")
            {
                MessageBox.Show("Ples You Should Write All Text Box");
                Fromtb.Select();
                return;
            }
            else if (Nametb.Text == "")
            {
                MessageBox.Show("Ples You Should Write The Third Text Box");
                Nametb.Select();
                return;
            }
            else if (Totb.Text == "")
            {
                MessageBox.Show("Ples You Should Write The Second Text Box");
                Totb.Select();
                return;
            }
    
            string fileName = Nametb.Text;
            string sourcePath = @"" + Fromtb.Text;
            string targetPath = @"" + Totb.Text;
    
    
            string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
            string destFile = System.IO.Path.Combine(targetPath, fileName);
    
    
            if (!System.IO.Directory.Exists(targetPath))
            {
                System.IO.Directory.CreateDirectory(targetPath);
                //when The User Write The New Folder It Will Create 
                MessageBox.Show("The File is Create in "+" "+Totb.Text);
            }
    
    
            System.IO.File.Copy(sourceFile, destFile, true);
    
    
            if (System.IO.Directory.Exists(sourcePath))
            {
                string[] files = System.IO.Directory.GetFiles(sourcePath);
    
    
                foreach (string s in files)
                {
                    fileName = System.IO.Path.GetFileName(s);
                    destFile = System.IO.Path.Combine(targetPath, fileName);
                    System.IO.File.Copy(s, destFile, true);
    
                }
                MessageBox.Show("The File is copy To " + Totb.Text);
    
            }
    
  2. 现在,在这个new_branch上挑选C4:

    git checkout -b new_branch <C1>
    
  3. 现在,在new_branch上挑选C#:

    git cherry-pick C4
    
  4. 以上内容应在git cherry-pick C3

    中提供所需的结果
    new_branch