简体   繁体   English

Git删除了我所有的更改,然后才提交

[英]Git Deleted all my changes before I committed them

ok I'm a newb at Git, only been using it for a week, but everything has been fine so far. 好的,我是Git的新手,只使用了一个星期,但到目前为止一切都很好。 I'm using GitHub Gui on mac. 我在Mac上使用GitHub Gui。 Accessing one project (just me alone) but from 2 different macs (work and home) So I get home, get latest version from the work commit. 访问一个项目(仅我一个人),但是访问2个不同的Mac(工作和家庭),所以我回到家,从工作提交中获取最新版本。 Work for a day, now its time to commit from home. 工作一天,现在是时候在家工作了。 I click on sync, and quickly on changes to list my copious changes for the day.. 50+ files or so. 我单击“同步”,然后快速单击更改以列出当天的大量更改。.50多个文件左右。 GitHub, pops up something about a conflict on a binary file (that I never touched, and shouldn't be in conflict as no one else is editing the project) It gives me some option like you can't commit your changes until you fix and commit this conflict. GitHub,在二进制文件上弹出一个有关冲突的信息(我从未碰过,并且应该没有冲突,因为没有其他人正在编辑该项目)。它给了我一些选择,例如在修复之前无法提交更改并犯下这一冲突。 I can't remember the second option, but I click commit. 我不记得第二个选项,但是单击提交。 It commits the conflicted binary file.. but then.... all my list of changes disappears from the changes window, and after loading up the project all the work for the day has gone... !!!!!!! 它提交了冲突的二进制文件..但是然后....我所有的更改列表从更改窗口中消失了,并且在加载项目之后,当天的所有工作都已经消失了! it is back to looking like it did at the start of the day. 回到一天开始时的样子。 there is no record of a commit or any changes in github, except for the conflicted single binary file, and the commit from previous day at work. 除了有冲突的单个二进制文件以及前一天的工作以外,在github中没有提交或更改的记录。

What happened ? 发生了什么 ? why were there no warnings ? 为什么没有警告? Surely this cannot be how Git is supposed to behave when there is a conflict ? 当然,这不是Git在发生冲突时的行为方式吗? Help please. 请帮助。 is my work still somewhere ? 我的工作还在吗?

You should try and resolve the merge conflict and then sync again. 您应该尝试解决合并冲突,然后再次同步。 Just find the spot where Git added to your binary file and delete the nasty stuff it added, plus whatever created the conflict. 只需找到Git添加到二进制文件的位置,然后删除它添加的令人讨厌的内容,再加上造成冲突的任何内容即可。 Then try to sync up again. 然后尝试再次同步。 It may be that Git just saved your recent changes in a local commit. Git可能只是将您最近的更改保存在本地提交中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM