{"id":59820,"date":"2018-09-07T11:00:58","date_gmt":"2018-09-07T08:00:58","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=59820"},"modified":"2019-04-23T14:16:04","modified_gmt":"2019-04-23T11:16:04","slug":"git-diff-between-branches-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/","title":{"rendered":"Git diff between Branches Example"},"content":{"rendered":"<p>In this post, we feature a comprehensive Example on Git diff between Branches.<\/p>\n<h2>1. Introduction<\/h2>\n<p>Version control system (VCS) software is designed to track and manage changes in a file repository. Branching is a common operation performed with any VCS. It allows a developer (or team of developers) to work on code or documents in a repository without affecting the mainline, which is used for deploying production-ready code.<\/p>\n<p>There are different reasons for creating a branch. You may want to develop a new feature or produce a hotfix for a critical defect. In each of these cases, it is essential that changes are made in a branch and the code tested before merging it back to the mainline and pushing it to production.<\/p>\n<p>Git is a popular VCS. One feature that makes Git standout among other VCSs is its branching mechanism. The mechanism used by Git to create and manage branches is both lightweight and efficient in comparison to other VCSs.\n<\/p>\n<h3>1.1 Tools Used in this Example<\/h3>\n<ul>\n<li>Git 2.17<\/li>\n<li>Maven 3.5.4<\/li>\n<li>DiffMerge 4.2<\/li>\n<\/ul>\n<p>Git downloads are available here: <a href=\"https:\/\/git-scm.com\/downloads\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/git-scm.com\/downloads<\/a>.<\/p>\n<p>Maven downloads are available here: <a href=\"https:\/\/maven.apache.org\/download.cgi\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/maven.apache.org\/download.cgi<\/a>.<br \/>\nInstructions for installing Maven are provided here: <a href=\"https:\/\/maven.apache.org\/install.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/maven.apache.org\/install.html<\/a>.<\/p>\n<p>DiffMerge downloads are available here: <a href=\"https:\/\/sourcegear.com\/diffmerge\/downloads.php\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/sourcegear.com\/diffmerge\/downloads.php<\/a>.<\/p>\n<p><strong>Note:<\/strong> This example was created on the macOS platform. Git for Windows includes Git Bash and Git CMD shells to run command-line operations.<\/p>\n<h2>2. Git diff between Branches Example<\/h2>\n<p>In this example, we will create a branch based on the mainline (or \u2018master\u2019 branch) of a Git repository. We will then make changes in the branch and use the Git \u2018diff\u2019 operation to compare the two.<\/p>\n<h3>2.1 Download and Extract the Sample Project<\/h3>\n<p>First, download the &#8220;REST API initial&#8221; archive from the <a href=\"#download\">Download<\/a> section and extract it in an empty directory of your choice.<\/p>\n<p><figure id=\"attachment_59825\" aria-describedby=\"caption-attachment-59825\" style=\"width: 815px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/rest-api-exploded-wm.jpeg\"><img decoding=\"async\" class=\"wp-image-59825 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/rest-api-exploded-wm.jpeg\" alt=\"Git diff between Branches - REST API Project\" width=\"815\" height=\"600\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/rest-api-exploded-wm.jpeg 815w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/rest-api-exploded-wm-300x221.jpeg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/rest-api-exploded-wm-768x565.jpeg 768w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><\/a><figcaption id=\"caption-attachment-59825\" class=\"wp-caption-text\">REST API Project<\/figcaption><\/figure><\/p>\n<h3>2.2 Create a Local Repository<\/h3>\n<p>Open a terminal (shell) in the directory where the archive was extracted and run the following command:<\/p>\n<pre class=\"brush:bash\">$ git init<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>Git init Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash\">Initialized empty Git repository in \/Users\/gilbertlopez\/gitdiffexample\/.git\/\n<\/pre>\n<p>This creates an empty Git repository. The repository metadata has been generated in the \u201c.git\u201d folder.<\/p>\n<p>(<strong>Note:<\/strong> This folder is hidden by default as you would, typically, not edit its contents.)<\/p>\n<p>Next, check the status with the following command:<\/p>\n<pre class=\"brush:bash\">$ git status<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>Git status Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash\">On branch master\n\nInitial commit\n\nUntracked files:\n  (use \"git add ...\" to include in what will be committed)\n\n\tREST-API\/\n\nnothing added to commit but untracked files present (use \"git add\" to track) \n<\/pre>\n<p>Notice the following two things:<\/p>\n<ul>\n<li>We are currently on branch &#8220;master&#8221; (the mainline or root trunk).<\/li>\n<li>The &#8220;REST-API&#8221; project is in the directory but will not be tracked until it is added to the repository.<\/li>\n<\/ul>\n<h3>2.3 Add and Commit the Project to the Repository<\/h3>\n<p>Let\u2019s add the project to the repository. Run the following command (don\u2019t forget the dot at the end):<\/p>\n<pre class=\"brush:bash\">$ git add .<\/pre>\n<p>This will add all the files and folders of the current directory, recursively, to the repository index. The project files and folders are now in the staging area. You can run the <code>git status<\/code> command to see the changes that are to be committed.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Git status Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash; wrap-lines:false\">$ git status\nOn branch master\n\nInitial commit\n\nChanges to be committed:\n  (use \"git rm --cached ...\" to unstage)\n\n\t        new file:   REST-API\/.gitignore\n        new file:   REST-API\/.mvn\/wrapper\/maven-wrapper.jar\n        new file:   REST-API\/.mvn\/wrapper\/maven-wrapper.properties\n        new file:   REST-API\/mvnw\n        new file:   REST-API\/mvnw.cmd\n        new file:   REST-API\/pom.xml\n        new file:   REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/RestApiAppl                           ication.java\n        new file:   REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/controller\/                           StudentController.java\n        new file:   REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/model\/Stude                           nt.java\n        new file:   REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/repository\/                           StudentRepository.java\n        new file:   REST-API\/src\/main\/resources\/application.properties\n        new file:   REST-API\/src\/main\/resources\/eyre.json\n        new file:   REST-API\/src\/main\/resources\/gates.json\n        new file:   REST-API\/src\/test\/java\/com\/javacodegeeks\/example\/RestApiAppl                           icationTests.java\n\n<\/pre>\n<p>To commit the files from the staging area to the repository, run the following command:<\/p>\n<pre class=\"brush:bash\">$ git commit -m 'Initial commit of project'<\/pre>\n<p><strong>Note:<\/strong> The <code>-m<\/code> option allows us to add a commit message inline.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Git commit Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash; wrap-lines:false\">master (root-commit) e682818] initial commit of project\n 14 files changed, 667 insertions(+)\n create mode 100755 REST-API\/.gitignore\n create mode 100755 REST-API\/.mvn\/wrapper\/maven-wrapper.jar\n create mode 100755 REST-API\/.mvn\/wrapper\/maven-wrapper.properties\n create mode 100755 REST-API\/mvnw\n create mode 100755 REST-API\/mvnw.cmd\n create mode 100755 REST-API\/pom.xml\n create mode 100755 REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/RestApiApplication.java\n create mode 100755 REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/controller\/StudentController.java\n create mode 100755 REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/model\/Student.java\n create mode 100755 REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/repository\/StudentRepository.java\n create mode 100755 REST-API\/src\/main\/resources\/application.properties\n create mode 100755 REST-API\/src\/main\/resources\/eyre.json\n create mode 100755 REST-API\/src\/main\/resources\/gates.json\n create mode 100755 REST-API\/src\/test\/java\/com\/javacodegeeks\/example\/RestApiApplicationTests.java<\/pre>\n<h3>2.4 Create a New Branch<\/h3>\n<p>Our application is a REST API student management service that allows clients to read, add, and update students.<\/p>\n<p>Let us imagine that there is a request to implement a new feature that gives the consumer of our API the ability to delete a student from the datastore. The first thing we should do is create a branch. Create a new branch named \u2018Feaure1\u2019 with the following Git command:<\/p>\n<pre class=\"brush:bash\">$ git branch Feature1<\/pre>\n<p>Now run the following command:<\/p>\n<pre class=\"brush:bash\">$ git branch\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>Git branch Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash\">  Feature1\n* master\n<\/pre>\n<p>As you can see from the output, there are two branches now. The <code>*<\/code> next to <code>master<\/code> tells us that we are in the master branch (the mainline). Let\u2019s switch to the Feature1 branch so we can work on the new feature.<\/p>\n<h3>2.5 Switch to the Feature1 Branch<\/h3>\n<p>To switch to the Feature1 branch, run the following command:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:bash\">$ git checkout Feature1\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>Git checkout Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash\">Switched to branch 'Feature1'\n<\/pre>\n<p><strong>Note:<\/strong> To create and switch to the branch using a single command, you can use the <code>-b<\/code> option with the checkout command. For example:<\/p>\n<pre class=\"brush:bash\">$ git checkout -b Feature1<\/pre>\n<p>Now we can happily work on the new feature without affecting the <code>master<\/code> branch.<\/p>\n<h3>2.6 Implement the New Feature<\/h3>\n<p>Add the following method to <code>StudentRepository.java<\/code> in the <code>com.javacodegeeks.example.repository<\/code> package and save the changes.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>StudentRepository.java<\/em><\/span><\/p>\n<pre class=\"brush:java; highlight:[49,50,51,52,53,54,55,56,57]; wrap-lines:false\">package com.javacodegeeks.example.repository;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.springframework.stereotype.Repository;\n\nimport com.javacodegeeks.example.model.Student;\n\n@Repository\npublic class StudentRepository {\n\t\n\tMap students = new HashMap();\n\tlong currentId = 100;\n\t\n\t\/\/ Return all students\n\tpublic Collection findAll(){\n\t\treturn students.values();\n\t}\n\n\t\/\/ Find the student with this id\n\tpublic Optional findById(Long id) {\n\t\tStudent student = null;\n\n\t\tif (students.containsKey(id)) student = students.get(id);\n\t\treturn Optional.ofNullable(student);\n\t}\n\t\t\n\t\/\/ Save a new student\t\n\tpublic Student save(Student student) {\n\t\tstudent.setId(++currentId);\n\t\tstudents.put(student.getId(), student);\n\t\treturn student;\n\t}\n\t\n\t\/\/ Update the student with this id\n\tpublic Optional update(Student student) {\n\t\tStudent currentStudent = students.get(student.getId());\n\n\t\tif (currentStudent != null) {\n\t\t\tstudents.put(student.getId(), student);\n\t\t\tcurrentStudent = students.get(student.getId());\n\t\t}\n\t\treturn Optional.ofNullable(currentStudent);\n\t}\n\n\t\/\/ Feature 1: Delete student with this id\n\tpublic Optional delete(Long id) {\n\t\tStudent currentStudent = students.get(id);\n\n\t\tif (currentStudent != null) {\n\t\t\tstudents.remove(id);\n\t\t}\n\t\treturn Optional.ofNullable(currentStudent);\n\t}\t\n\n}\n<\/pre>\n<p>Now add the following import statement and method to <code>StudentController.java<\/code> in the <code>com.javacodegeeks.example.controller<\/code> package and save the changes.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>StudentController.java<\/em><\/span><\/p>\n<pre class=\"brush:java; highlight:[9, 72,73,74,75,76,77]; wrap-lines:false\">package com.javacodegeeks.example.controller;\n\nimport java.net.URI;\nimport java.util.Collection;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.http.HttpStatus;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.web.bind.annotation.DeleteMapping;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.PostMapping;\nimport org.springframework.web.bind.annotation.PutMapping;\nimport org.springframework.web.bind.annotation.RequestBody;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.ResponseStatus;\nimport org.springframework.web.bind.annotation.RestController;\nimport org.springframework.web.servlet.support.ServletUriComponentsBuilder;\n\nimport com.javacodegeeks.example.model.Student;\nimport com.javacodegeeks.example.repository.StudentRepository;\n\n@RestController\n@RequestMapping(\"\/students\")\npublic class StudentController {\n\n\tprivate final StudentRepository repository;\n\n\t@Autowired\n\tpublic StudentController(StudentRepository repository) {\n\t\tthis.repository = repository;\n\t}\n\t\n\t@SuppressWarnings(\"serial\")\n\t@ResponseStatus(HttpStatus.NOT_FOUND)\n\tclass StudentNotFoundException extends RuntimeException {\n\n\t\tpublic StudentNotFoundException() {\n\t\t\tsuper(\"Student does not exist\");\n\t\t}\n\t}\n\t\n\t@GetMapping\n\tCollection readStudents(){\n\t\treturn this.repository.findAll();\n\t}\n\t\n\t@GetMapping(\"\/{id}\")\n\tStudent readStudent(@PathVariable Long id) {\n\t\treturn this.repository.findById(id)\n\t\t\t\t.orElseThrow(StudentNotFoundException::new);\n\t}\n\t\n\t@PostMapping\n\tResponseEntity addStudent(@RequestBody Student student){\n\t\tStudent result = this.repository.save(student);\n\t\tURI location = ServletUriComponentsBuilder\n\t\t\t\t.fromCurrentRequest()\n\t\t\t\t.path(\"\/{id}\")\n\t\t\t\t.buildAndExpand(result.getId())\n\t\t\t\t.toUri();\n\n\t\treturn ResponseEntity.created(location).build();\t\t\n\t}\n\t\n\t@PutMapping\n\tStudent updateStudent(@RequestBody Student student) {\n\t\treturn this.repository.update(student)\n\t\t\t\t.orElseThrow(StudentNotFoundException::new);\n\t}\n\n\t\/\/ Feature 1: Delete student with this id\n\t@DeleteMapping(\"\/{id}\")\n\tvoid deleteStudent(@PathVariable Long id) {\n\t\tthis.repository.delete(id)\n\t\t\t.orElseThrow(StudentNotFoundException::new);\n\t}\n\n}\n<\/pre>\n<h3>2.7 Test the Application<\/h3>\n<p>Navigate to the REST-API directory and run the following command:<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">$ mvn spring-boot:run\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>Maven spring-boot Run Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash; wrap-lines:false\">[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------\n[INFO] Building REST-API 0.0.1-SNAPSHOT\n[INFO] --------------------------------[ jar ]---------------------------------\n[INFO] \n[INFO] &gt;&gt;&gt; spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) &gt; test-compile @ REST-API &gt;&gt;&gt;\n[INFO] \n[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ REST-API ---\n[INFO] Using 'UTF-8' encoding to copy filtered resources.\n[INFO] Copying 1 resource\n[INFO] Copying 2 resources\n[INFO] \n[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ REST-API ---\n[INFO] Changes detected - recompiling the module!\n[INFO] Compiling 4 source files to \/Users\/gilbertlopez\/gitdiffexample\/REST-API\/target\/classes\n[INFO] \n[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ REST-API ---\n[INFO] Using 'UTF-8' encoding to copy filtered resources.\n[INFO] skip non existing resourceDirectory \/Users\/gilbertlopez\/gitdiffexample\/REST-API\/src\/test\/resources\n[INFO] \n[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ REST-API ---\n[INFO] Changes detected - recompiling the module!\n[INFO] Compiling 1 source file to \/Users\/gilbertlopez\/gitdiffexample\/REST-API\/target\/test-classes\n[INFO] \n[INFO] &lt;&lt;&lt; spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) &lt; test-compile @ REST-API &lt;&lt;&lt;\n[INFO] \n[INFO] \n[INFO] --- spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) @ REST-API ---\n\n  .   ____          _            __ _ _\n \/\\\\ \/ ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\\n( ( )\\___ | '_ | '_| | '_ \\\/ _` | \\ \\ \\ \\\n \\\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )\n  '  |____| .__|_| |_|_| |_\\__, | \/ \/ \/ \/\n =========|_|==============|___\/=\/_\/_\/_\/\n :: Spring Boot ::        (v2.0.4.RELEASE)\n\n2018-08-31 16:15:05.696  INFO 1216 --- [           main] c.j.example.RestApiApplication           : Starting RestApiApplication on Gilberts-MBP.attlocal.net with PID 1216 (\/Users\/gilbertlopez\/gitdiffexample\/REST-API\/target\/classes started by gilbertlopez in \/Users\/gilbertlopez\/gitdiffexample\/REST-API)\n2018-08-31 16:15:05.702  INFO 1216 --- [           main] c.j.example.RestApiApplication           : No active profile set, falling back to default profiles: default\n2018-08-31 16:15:05.817  INFO 1216 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6caaa61b: startup date [Fri Aug 31 16:15:05 PDT 2018]; root of context hierarchy\n2018-08-31 16:15:08.104  INFO 1216 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)\n2018-08-31 16:15:08.161  INFO 1216 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]\n2018-08-31 16:15:08.162  INFO 1216 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat\/8.5.32\n2018-08-31 16:15:08.184  INFO 1216 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [\/Users\/gilbertlopez\/Library\/Java\/Extensions:\/Library\/Java\/Extensions:\/Network\/Library\/Java\/Extensions:\/System\/Library\/Java\/Extensions:\/usr\/lib\/java:.]\n2018-08-31 16:15:08.329  INFO 1216 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[\/]       : Initializing Spring embedded WebApplicationContext\n2018-08-31 16:15:08.329  INFO 1216 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2518 ms\n2018-08-31 16:15:08.427  INFO 1216 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [\/]\n2018-08-31 16:15:08.433  INFO 1216 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [\/*]\n2018-08-31 16:15:08.433  INFO 1216 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [\/*]\n2018-08-31 16:15:08.433  INFO 1216 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [\/*]\n2018-08-31 16:15:08.434  INFO 1216 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [\/*]\n2018-08-31 16:15:08.666  INFO 1216 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [\/**\/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]\n2018-08-31 16:15:09.016  INFO 1216 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6caaa61b: startup date [Fri Aug 31 16:15:05 PDT 2018]; root of context hierarchy\n2018-08-31 16:15:09.187  INFO 1216 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped \"{[\/students],methods=[GET]}\" onto java.util.Collection com.javacodegeeks.example.controller.StudentController.readStudents()\n2018-08-31 16:15:09.189  INFO 1216 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped \"{[\/students\/{id}],methods=[GET]}\" onto com.javacodegeeks.example.model.Student com.javacodegeeks.example.controller.StudentController.readStudent(java.lang.Long)\n2018-08-31 16:15:09.190  INFO 1216 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped \"{[\/students],methods=[POST]}\" onto org.springframework.http.ResponseEntity com.javacodegeeks.example.controller.StudentController.addStudent(com.javacodegeeks.example.model.Student)\n2018-08-31 16:15:09.191  INFO 1216 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped \"{[\/students],methods=[PUT]}\" onto com.javacodegeeks.example.model.Student com.javacodegeeks.example.controller.StudentController.updateStudent(com.javacodegeeks.example.model.Student)\n2018-08-31 16:15:09.191  INFO 1216 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped \"{[\/students\/{id}],methods=[DELETE]}\" onto void com.javacodegeeks.example.controller.StudentController.deleteStudent(java.lang.Long)\n2018-08-31 16:15:09.195  INFO 1216 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped \"{[\/error]}\" onto public org.springframework.http.ResponseEntity&lt;java.util.Map&gt; org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)\n2018-08-31 16:15:09.198  INFO 1216 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped \"{[\/error],produces=}\" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)\n2018-08-31 16:15:09.248  INFO 1216 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [\/webjars\/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]\n2018-08-31 16:15:09.248  INFO 1216 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [\/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]\n2018-08-31 16:15:09.603  INFO 1216 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup\n2018-08-31 16:15:09.691  INFO 1216 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''\n2018-08-31 16:15:09.698  INFO 1216 --- [           main] c.j.example.RestApiApplication           : Started RestApiApplication in 4.747 seconds (JVM running for 11.57)\n<\/pre>\n<p>This will compile and start the application. You can now test the new feature. (For instructions on testing this application, please visit: <a href=\"https:\/\/examples.javacodegeeks.com\/enterprise-java\/spring\/boot\/spring-boot-rest-api-tutorial\/#test\" target=\"_blank\" rel=\"noopener noreferrer\">Spring Boot REST API Tutorial<\/a>.)[ulp id=&#8217;pzgfvmZhgslwSymm&#8217;]<\/p>\n<h3>2.8 Commit Changes to New Branch<\/h3>\n<p>Once your test cases have passed, it is time to commit the changes to the feature branch. Navigate to the parent directory of REST-API and run the following command.<\/p>\n<pre class=\"brush:bash\">$ git commit -a -m 'Feature 1: Delete student'\n<\/pre>\n<p>The <code>-a<\/code> option lets us skip the <code>git add<\/code> command and the <code>-m<\/code> option allows us to add a commit message inline.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Git commit Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash; wrap-lines:false\">[Feature1 7878c76] &nbsp;Feature 1: Delete student\n 2 files changed, 19 insertions(+), 1 deletion(-)\n<\/pre>\n<p>At this point, the \u2018Feature1\u2019 branch and the \u2018master\u2019 branch are pointing to different commits<\/p>\n<p><figure id=\"attachment_59882\" aria-describedby=\"caption-attachment-59882\" style=\"width: 786px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/branches-wm.jpg\"><img decoding=\"async\" class=\"wp-image-59882 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/branches-wm.jpg\" alt=\"Git diff between Branches - Two Branches Pointing to Different Commits\" width=\"786\" height=\"564\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/branches-wm.jpg 786w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/branches-wm-300x215.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/branches-wm-768x551.jpg 768w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/a><figcaption id=\"caption-attachment-59882\" class=\"wp-caption-text\">Two Branches Pointing to Different Commits<\/figcaption><\/figure><\/p>\n<p>Let\u2019s compare the branches.<\/p>\n<h3>2.7 Compare the Branches using Git diff<\/h3>\n<p>There are different compare tools available for viewing differences between file versions in a git repository, or for that matter, file differences between branches. The Git distribution includes the diff command.<\/p>\n<p>Let\u2019s compare the feature1 branch against the master branch. Run the following command:<\/p>\n<pre class=\"brush:bash\">$ git diff master\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>Git diff Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash; wrap-lines:false\">diff --git a\/REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/controller\/StudentController.java b\/REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/controller\/StudentController.java\nindex dc28c31..a07e95e 100755\n--- a\/REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/controller\/StudentController.java\n+++ b\/REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/controller\/StudentController.java\n@@ -5,7 +5,8 @@ import java.util.Collection;\n \n import org.springframework.beans.factory.annotation.Autowired;\n import org.springframework.http.HttpStatus;\n-import org.springframework.http.ResponseEntity;\n+import org.springframework.http.ResponseEntity;\n+import org.springframework.web.bind.annotation.DeleteMapping;^M\n import org.springframework.web.bind.annotation.GetMapping;\n import org.springframework.web.bind.annotation.PathVariable;\n import org.springframework.web.bind.annotation.PostMapping;\n@@ -66,6 +67,13 @@ public class StudentController {\n        Student updateStudent(@RequestBody Student student) {\n                return this.repository.update(student)\n                                .orElseThrow(StudentNotFoundException::new);\n+       }\n+\n+       \/\/ Feature 1: Delete student with this id\n+       @DeleteMapping(\"\/{id}\")\n+       void deleteStudent(@PathVariable Long id) {\n+               this.repository.delete(id)\n+                       .orElseThrow(StudentNotFoundException::new);\n        }\n \n }\n<\/pre>\n<p>Press the space bar to see the other change we committed.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Git diff Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash; wrap-lines:false\">diff --git a\/REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/repository\/StudentRepository.java b\/REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/repository\/StudentRepository.java\nindex 9a9bdc7..76615f6 100755\n--- a\/REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/repository\/StudentRepository.java\n+++ b\/REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/repository\/StudentRepository.java\n@@ -44,6 +44,16 @@ public class StudentRepository {\n                        currentStudent = students.get(student.getId());\n                }\n                return Optional.ofNullable(currentStudent);\n+       }\n+\n+       \/\/ Feature 1: Delete student with this id\n+       public Optional delete(Long id) {\n+               Student currentStudent = students.get(id);\n+\n+               if (currentStudent != null) {\n+                       students.remove(id);\n+               }\n+               return Optional.ofNullable(currentStudent);\n        }\n \n }\n<\/pre>\n<p>Hit <code>q<\/code> to quit. On Windows, you may need to hit Control + \\ to quit.<\/p>\n<p>If you have a GUI tool such as DiffMerge or Beyond Compare installed on your system, you can configure Git to use it with the <code>config<\/code> command. For example, run the following command to have Git use DiffMerge as your diff tool:<\/p>\n<pre class=\"brush:bash\">$ git config --global diff.tool diffmerge<\/pre>\n<p>Now you can run the Git <code>difftool<\/code> command.<\/p>\n<pre class=\"brush:bash\">$ git difftool master<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>Git difftool Command Output<\/em><\/span><\/p>\n<pre class=\"brush:bash; wrap-lines:false\">Viewing (1\/2): 'REST-API\/src\/main\/java\/com\/javacodegeeks\/example\/controller\/StudentController.java'\nLaunch 'diffmerge' [Y\/n]? \n<\/pre>\n<p>Enter &#8216;y&#8217; at the prompt and hit enter. This will launch DiffMerge.<\/p>\n<p><figure id=\"attachment_59912\" aria-describedby=\"caption-attachment-59912\" style=\"width: 815px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/winmerge-wm.jpg\"><img decoding=\"async\" class=\"wp-image-59912 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/winmerge-wm.jpg\" alt=\"Git diff between Branches - DiffMerge\" width=\"815\" height=\"563\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/winmerge-wm.jpg 815w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/winmerge-wm-300x207.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/winmerge-wm-768x531.jpg 768w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><\/a><figcaption id=\"caption-attachment-59912\" class=\"wp-caption-text\">DiffMerge<\/figcaption><\/figure><\/p>\n<h2><a name=\"summary\"><\/a><br \/>\n3. Summary<\/h2>\n<p>In this post, we demonstrated how to create a branch in Git and showed how to compare the branch against the mainline using Git\u2019s diff command.<\/p>\n<h2><a name=\"download\"><\/a><br \/>\n4. Download the Source Code<\/h2>\n<p>That was Git diff between Branches Example.<\/p>\n<div class=\"download\">\n<strong>Download<\/strong><br \/>\nYou can download the full source code of this example here:<\/p>\n<ul>\n<li><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/09\/rest-api-initial.zip\">REST API initial<\/a><\/li>\n<li><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2018\/07\/REST-API.zip\">REST API complete<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this post, we feature a comprehensive Example on Git diff between Branches. 1. Introduction Version control system (VCS) software is designed to track and manage changes in a file repository. Branching is a common operation performed with any VCS. It allows a developer (or team of developers) to work on code or documents in &hellip;<\/p>\n","protected":false},"author":121,"featured_media":27377,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1353],"tags":[1203,1508,1402],"class_list":["post-59820","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-git","tag-git","tag-git-branch","tag-git-diff"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Git diff between Branches Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn more about Git? Then check out our detailed example on Git diff between Branches! You can also download our FREE Git Tutorial!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git diff between Branches Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn more about Git? Then check out our detailed example on Git diff between Branches! You can also download our FREE Git Tutorial!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-07T08:00:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-23T11:16:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Gilbert Lopez\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@gillopez_dev\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gilbert Lopez\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/\"},\"author\":{\"name\":\"Gilbert Lopez\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6169578062b8f6f6a1f79c82aafdb9ce\"},\"headline\":\"Git diff between Branches Example\",\"datePublished\":\"2018-09-07T08:00:58+00:00\",\"dateModified\":\"2019-04-23T11:16:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/\"},\"wordCount\":1088,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"keywords\":[\"git\",\"git branch\",\"Git diff\"],\"articleSection\":[\"Git\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/\",\"name\":\"Git diff between Branches Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"datePublished\":\"2018-09-07T08:00:58+00:00\",\"dateModified\":\"2019-04-23T11:16:04+00:00\",\"description\":\"Interested to learn more about Git? Then check out our detailed example on Git diff between Branches! You can also download our FREE Git Tutorial!\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Software Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/software-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Git\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/software-development\/git\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Git diff between Branches Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6169578062b8f6f6a1f79c82aafdb9ce\",\"name\":\"Gilbert Lopez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/04\/Gilbert-Lopez_avatar_1492457226-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/04\/Gilbert-Lopez_avatar_1492457226-96x96.jpg\",\"caption\":\"Gilbert Lopez\"},\"description\":\"Gilbert Lopez is an application developer and systems integration developer with experience building business solutions for large and medium-sized companies. He has worked on many Java EE projects. His roles have included lead developer, systems analyst, business analyst and consultant. Gilbert graduated from California State University in Los Angeles with a Bachelor of Science degree in Business.\",\"sameAs\":[\"https:\/\/www.javacodegeeks.com\",\"https:\/\/www.linkedin.com\/in\/gilbertlopezdeveloper\",\"https:\/\/x.com\/gillopez_dev\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/gilbert-lopez\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Git diff between Branches Example - Java Code Geeks","description":"Interested to learn more about Git? Then check out our detailed example on Git diff between Branches! You can also download our FREE Git Tutorial!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/","og_locale":"en_US","og_type":"article","og_title":"Git diff between Branches Example - Java Code Geeks","og_description":"Interested to learn more about Git? Then check out our detailed example on Git diff between Branches! You can also download our FREE Git Tutorial!","og_url":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2018-09-07T08:00:58+00:00","article_modified_time":"2019-04-23T11:16:04+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","type":"image\/jpeg"}],"author":"Gilbert Lopez","twitter_card":"summary_large_image","twitter_creator":"@gillopez_dev","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Gilbert Lopez","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/"},"author":{"name":"Gilbert Lopez","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6169578062b8f6f6a1f79c82aafdb9ce"},"headline":"Git diff between Branches Example","datePublished":"2018-09-07T08:00:58+00:00","dateModified":"2019-04-23T11:16:04+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/"},"wordCount":1088,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","keywords":["git","git branch","Git diff"],"articleSection":["Git"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/","url":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/","name":"Git diff between Branches Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","datePublished":"2018-09-07T08:00:58+00:00","dateModified":"2019-04-23T11:16:04+00:00","description":"Interested to learn more about Git? Then check out our detailed example on Git diff between Branches! You can also download our FREE Git Tutorial!","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-diff-between-branches-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Software Development","item":"https:\/\/examples.javacodegeeks.com\/category\/software-development\/"},{"@type":"ListItem","position":3,"name":"Git","item":"https:\/\/examples.javacodegeeks.com\/category\/software-development\/git\/"},{"@type":"ListItem","position":4,"name":"Git diff between Branches Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6169578062b8f6f6a1f79c82aafdb9ce","name":"Gilbert Lopez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/04\/Gilbert-Lopez_avatar_1492457226-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/04\/Gilbert-Lopez_avatar_1492457226-96x96.jpg","caption":"Gilbert Lopez"},"description":"Gilbert Lopez is an application developer and systems integration developer with experience building business solutions for large and medium-sized companies. He has worked on many Java EE projects. His roles have included lead developer, systems analyst, business analyst and consultant. Gilbert graduated from California State University in Los Angeles with a Bachelor of Science degree in Business.","sameAs":["https:\/\/www.javacodegeeks.com","https:\/\/www.linkedin.com\/in\/gilbertlopezdeveloper","https:\/\/x.com\/gillopez_dev"],"url":"https:\/\/examples.javacodegeeks.com\/author\/gilbert-lopez\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/59820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/121"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=59820"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/59820\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/27377"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=59820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=59820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=59820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}