GIT损坏的文件(<<<<<<<<<<<< [英] GIT corrupt files (<<<<<<<<HEAD)

查看:96
本文介绍了GIT损坏的文件(<<<<<<<<<<<<的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这在我的文件后,一些麻烦VS2012混帐插件:

 使用Microsoft.VisualStudio.TestTools.UnitTesting ; 
<<<<<< HEAD
使用NHibernate;
=======
>>>>>>> dd2c3d7dfe81074e7c5a73f8e4ca2584481a74f1

命名空间Controll.Hosting.Tests
{
[识别TestClass]
公共类TestBase
{
将<<< ;<<< HEAD
保护了ISessionFactory的SessionFactory;

[TestInitialize]
公共无效InitializeTestBase()
{
的SessionFactory = NHibernateHelper.GetSessionFactoryForMockedData();
=======
[ClassInitialize]
公共无效InitializeTest()
{
Console.WriteLine( 设置NHibernateHelper.IsInTesting - >真 );
NHibernateHelper.IsInTesting = true;
>>>>>>> dd2c3d7dfe81074e7c5a73f8e4ca2584481a74f1
}
}
}



如何重置我的您有什么不是麻烦,而是冲突

。这种情况发生在两个不同的人在同一地点修改文件时(您在同一行中添加/删除/修改内容)。



您可以简单地更新通过决定保持<<<<<<<<< HEAD ======= 之间或 ======= >>>>>>>< / code>或这两者的一些组合。一旦你解决了所有的冲突,你只需要提交你的修改。



放弃文件,你可以这样做:

$ p $ g $ cit checkout yourfile
$ / code>

或者,对于所有使用的文件

  git checkout  - 。 

您也可以为每个文件决定是否要保留版本或存储库版本

  git checkout --ours yourfile#您的版本
git checkout - 他们的yourfile#版本库版本


I have this in my files after some trouble with VS2012 git-plugin:

using Microsoft.VisualStudio.TestTools.UnitTesting;
<<<<<<< HEAD
using NHibernate;
=======
>>>>>>> dd2c3d7dfe81074e7c5a73f8e4ca2584481a74f1

namespace Controll.Hosting.Tests
{
[TestClass]
public class TestBase
{
<<<<<<< HEAD
    protected ISessionFactory SessionFactory;

    [TestInitialize]
    public void InitializeTestBase()
    {
            SessionFactory = NHibernateHelper.GetSessionFactoryForMockedData();
=======
    [ClassInitialize]
    public void InitializeTest()
    {
        Console.WriteLine("Settings NHibernateHelper.IsInTesting -> True");
        NHibernateHelper.IsInTesting = true;
>>>>>>> dd2c3d7dfe81074e7c5a73f8e4ca2584481a74f1
        }
    }
}

How can i reset my files?

解决方案

What you had wasn't trouble but conflicts. This happens when the files are modified by two different persons at the same place (you both add/remove/modify things inside the same lines).

You can simply update your files manually, by deciding to keep everything between <<<<<<< HEAD and =======, or between ======= and >>>>>>>, or some mix of the two. Once you resolve all your conflicts, you just need to commit your changes.

To discard local changes on a file, you can do

git checkout yourfile

or, for all files using

git checkout -- .

You can also decide, for each file, if you want to keep your version or the repository version with

git checkout --ours yourfile # Your version
git checkout --theirs yourfile # Repository version

这篇关于GIT损坏的文件(&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆