I had a similar problem (probably equal to the work of git gui), which can be useful for everyone who has it.
When fixing my pom.xml via git add -e pom.xml patch was as follows.
diff --git a/pom.xml b/pom.xml index 3dba69a..a9c8ebb 100644 --- a/pom.xml +++ b/pom.xml @@ -1,26 +1,48 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>adowrath</groupId> <artifactId>project-name</artifactId> <version>0.0.1</version> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> <build> <sourceDirectory>src/main/java</sourceDirectory> <testSourceDirectory>src/test/java</testSourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.9</version> + <executions> + <execution> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>report</id> + <phase>test</phase> + <goals> + <goal>report</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.16</version> <configuration> <includes> <include>**/Test*.java</include> <include>**/*Test.java</include> <include>**/*Tests.java</include> @@ -32,9 +54,15 @@ </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>2.5.5</version> + <scope>test</scope> + </dependency> </dependencies> </project>
And I wanted to remove the last block with a Mockito dependency. If I just delete the lines, it always gives me an error message on line 64:
fatal: corrupt patch at line 64 fatal: Could not apply '.git/ADD_EDIT.patch'
Line 64 is the last line in the patch file, so the line is after <project> .
The solution was to simply delete the entire body, so everything from the line @@ is down, and it worked immediately.
Hope this helps.
source share