Git pull - 错误条目notuptodate无法合并

Dav*_*d E 1 git

我是GIT的新手,想知道如何获得最新版本的主干并且放弃我所有的变化.

我似乎得到的只是notuptodate错误.我不想保存旧的变化......

我也明白了Your branch is behind 'origin/master' by 15 commits, and can be fast-forwarded.我如何快进?同样,我并不关心我所做的改变.

非常感谢,因为我目前在SO上的答案似乎假设你希望保持变化

错误示例(以及已经尝试过的事情)

$ git checkout 

$ git pull 

Updating 69edec1..dc3fdfe error: Entry 'src/FluentNHibernate.Testing/DomainModel/Mapping/CompositeIdentityPartTester.cs' not uptodate. Cannot merge.

$ git checkout -- src/FluentNHibernate.Testing/DomainModel/Mapping/CompositeIdentityPartTester.cs 

$ git pull 

Updating 69edec1..dc3fdfe error: Entry 'src/FluentNHibernate.Testing/DomainModel/Mapping/CompositeIdentityPartTester.cs' not uptodate. Cannot merge.

$ git reset --hard

$ git pull 

Updating 69edec1..dc3fdfe error: Entry 'src/FluentNHibernate.Testing/DomainModel/Mapping/CompositeIdentityPartTester.cs' not uptodate. Cannot merge.
Run Code Online (Sandbox Code Playgroud)

修复:我似乎通过使用gitk --all和使用GUI对最新的更改进行硬重置来解决问题...我仍然真的想了解为什么命令行不会这样做?

Jos*_*Lee 12

要丢弃所有更改并返回到最新提交,请使用

git reset --hard HEAD
Run Code Online (Sandbox Code Playgroud)

快进是一种合并,没有实际的合并要做,你只需要沿着提交跳转.在这种情况下,Git是没有真正告诉你什么做的,但它让你知道,你真的应该拉(因为这将是微不足道的).