{"id":17420,"date":"2020-11-30T21:36:06","date_gmt":"2020-12-01T05:36:06","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=17420"},"modified":"2023-12-01T04:05:04","modified_gmt":"2023-12-01T12:05:04","slug":"git-diff","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/git-diff\/","title":{"rendered":"Git Diff: A How-To Guide"},"content":{"rendered":"\n<p><em>The git diff command shows the differences between the files in two commits or between your current repository and a previous commit. This command displays changes denotes by headers and metadata for the files that have changed.<\/em><\/p>\n\n\n\n<p>When you\u2019re working with the Git version control system, you may want to compare data in your repository with another data source. For instance, you may want to compare two different commits with each other, or two files.<\/p>\n\n\n\n<p>That\u2019s where the diff function comes in. Diffing is a function that accepts two inputs and presents the changes that exist between those data sources. Diff functions can be executed on branches, files, and commits.<\/p>\n\n\n\n<p>This tutorial will discuss, with examples, the basics of diffing with Git and how to use the git diff command. By the end of reading this tutorial, you\u2019ll be an expert at using the git diff command.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Git Diff Command<\/h2>\n\n\n\n<p>The git diff command displays the differences between files in two commits or between a commit and your current repository. You can see what text has been added to, removed from, and changed in a file.<\/p>\n\n\n\n<p>Here\u2019s the syntax for the git diff command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git diff<\/pre><\/div>\n\n\n\n<p>By default, the git diff command displays any uncommitted changes to your repository. <\/p>\n\n\n\n<p>We can see the removed lines from our original file as well as any lines added to or changed in our original file. Often, Git diff is used for comparing branches in a Git repository.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Git Diff Between Commits<\/h2>\n\n\n\n<p>You can compare files between two <a href=\"https:\/\/careerkarma.com\/blog\/git-commit\/\">Git commits<\/a> by specifying the name of the ref that refers to the commits you want to compare. A ref may be a commit ID or HEAD, which refers to the current branch.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git diff &lt;commit1&gt; &lt;commit2&gt;<\/pre><\/div>\n\n\n\n<p>Let&#8217;s compare two commits in our Git repository.<\/p>\n\n\n\n<p>To do so, you first need to retrieve the ID of the commits whose files you want to compare. You can accomplish this task using the git log \u2013pretty=oneline command, which returns a brief summary of all the commits in a repo:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git log --pretty=oneline<\/pre><\/div>\n\n\n\n<p>This command returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>5141ea9c41cdc7152408bfcab54a910f34441855 (HEAD -&gt;; master) feat: Update README.md\n749055ee99df2aa6f5adc4cbe4bfc708395f1c2e docs: Create README.md<\/pre><\/div>\n\n\n\n<p>Now, suppose we want to compare these two commits. We can do so using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git diff 5141ea9c41cdc7152408bfcab54a910f34441855 749055ee99df2aa6f5adc4cbe4bfc708395f1c2e<\/pre><\/div>\n\n\n\n<p>The above command will perform a diff operation across our two commits.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Git Diff Between Branches<\/h2>\n\n\n\n<p>To compare two <a href=\"https:\/\/careerkarma.com\/blog\/git-branch\/\">Git branches<\/a> using the diff command, specify the two branches you want to compare as arguments. You need to use two dots between each branch name. These dots indicate that you want to read the latest commit in each of the branches and compare them:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git diff &lt;branch1&gt;..&lt;branch2&gt;<\/pre><\/div>\n\n\n\n<p>Suppose we wanted to compare the \u201cmaster\u201d branch with a branch called \u201cdev-v0.9\u201d in our repository. We could do so using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git diff master dev-v0.9<\/pre><\/div>\n\n\n\n<p>When this command is executed, a diff will be run between the \u201cmaster\u201d and \u201cdev-v0.9\u201d branches in our codebase.<\/p>\n\n\n\n<p>Similarly, you can compare specific files across two different branches. To do so, you can use the same syntax as above and additionally specify the file which you want to compare.<\/p>\n\n\n\n<p>Suppose we wanted to compare the file README.md across our \u201cmaster\u201d and \u201cdev-v0.9\u201d branches. We could do so using this code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git diff master dev-v0.9 .\/README.md<\/pre><\/div>\n\n\n\n<p>This will compare the file README.md (which is in our current directory, denoted by the \u201c.\/\u201d syntax) across the \u201cmaster\u201d and \u201cdev-v0.9\u201d branches.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Git Diff Command Example<\/h2>\n\n\n\n<p>Let\u2019s suppose we have initialized a blank repository, and we want to start our repository with a README.md file. We have created a README.md file in our repository that contains the following sentence:<\/p>\n\n\n\n<p>This is an example of the Git diff feature.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Prepare Files and Commits<\/h3>\n\n\n\n<p>We are going to create a commit with this file using the git commit command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git commit<\/pre><\/div>\n\n\n\n<p>This allows us to save the changes we have made to our repository. The git command returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>[master (root-commit) 749055e] docs: Create README.md\n1 file changed, 1 insertion(+)\ncreate mode 100644 README.md<\/pre><\/div>\n\n\n\n<p>If we run the git diff command at this stage, nothing will happen. This is because our repository has been initialized, and there are no changes between any files in our repository. Now that we have a basic repository, we can change the contents of the files in our repo. This will allow us to see the git diff command in action.<\/p>\n\n\n\n<p>Suppose we want to add the sentence \u201cWe just added this line to our file.\u201d to the README.md file. We could do so using this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>echo &quot;We just added this line to our file.&quot; &gt;&gt; README.md<\/pre><\/div>\n\n\n\n<p>The above command adds our sentence to the README.md file.<\/p>\n\n\n\n<p>This means that there is now a difference between our initial README.md file and the current README.md file in our repository.<\/p>\n\n\n\n<p>By executing the git diff command, we can see the differences between these two files. By default, the git diff command produces a diff for all files between the latest commit and the current state of the repository.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Run a Git Diff Between Commits<\/h3>\n\n\n\n<p>When we run the command, the following response is returned:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>diff --git a\/README.md b\/README.md\nindex f808522..f08e544 100644\n--- a\/README.md\n+++ b\/README.md\n@@ -1 +1,2 @@\n+We have just added this line to our file.<\/pre><\/div>\n\n\n\n<p> This is an example of the Git diff feature.<\/p>\n\n\n\n<p>This is a typical result from the git diff command. Our result shows what has been added or removed in our file in a combined diff format.<\/p>\n\n\n\n<p>The git diff command returns a list of all the changes in all the files between our last commit and our current repository.<\/p>\n\n\n\n<p>If you want to retrieve the changes made to a specific file in a repository, you can specify that file as a third parameter. Suppose we only want to see the changes made to the README.md file.<\/p>\n\n\n\n<p>In this example, we have only changed the README.md file, so only those changes would be shown anyway. But if we were working with a larger repo, we may want to compare only the changes in one file. To do so, we could use this command:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git diff README.md<\/pre><\/div>\n\n\n\n<p>This command allows us to compare our current version of the README.md file with the last version committed to our repository.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Git Diff Breakdown<\/h2>\n\n\n\n<p>Git diffs feature a number of components that we can use to analyze the changes between a file in a repository. Let\u2019s break them down, with reference to our previous example.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Input Files<\/h3>\n\n\n\n<p>The first component of our diff is the <strong>input files<\/strong>. This part of the diff tells us which files are being compared in the diff.<\/p>\n\n\n\n<p>We are comparing the README.md file in the current version of our code to the README.md file in the last version of our code. This is stated on the first line of our code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>diff --git a\/README.md b\/README.md<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Metadata<\/h3>\n\n\n\n<p>Next, our diff contains the <strong>metadata<\/strong> for our Git repository. This metadata displays the object version labels used by Git to track the changes you have made to a file.<\/p>\n\n\n\n<p>This information is rarely used in most cases of the diff command. In our above example, the metadata looks like this:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>index f808522..f08e544 100644<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Change Markers<\/h3>\n\n\n\n<p>The next part of the Git diff output is the <strong>change markers<\/strong>. These file pattern markers tell us what type of changes have been made to our files. The change markers for our above example are:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>--- a\/README.md\n+++ b\/README.md<\/pre><\/div>\n\n\n\n<p>These markers tell us that changes from a\/README.md have been made (denoted by the minus signs), which are reflected in b\/README.md (denotes by the plus signs).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Code Changes<\/h3>\n\n\n\n<p>Finally, our diff returns a list of the <strong>changes made to our code<\/strong>. Unlike a full file comparison, diffs only show the sections of a file that have been changed. In our example, we added one line to our file, which returned the following result:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>@@ -1 +1,2 @@\n This is an example of the Git diff feature.\n+We have just added this line to our file.<\/pre><\/div>\n\n\n\n<p>The first line is a summary of the changes made to our file. This tells us that we have added one line of code to our file (+1) starting on the second line (2).<\/p>\n\n\n\n<p>Then, we are shown a list of the changes made. As you can see, because we added the line \u201cWe have just added this line to our file.\u201d, that line appears in our diff. The plus sign tells us that we added that line to the file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Diffing is a useful function in Git that allows you to compare two files, branches, or commits in a Git repository. This allows you to see what changes have been made since a certain point in your repository.<\/p>\n\n\n\n<p>This tutorial discussed the basics of diffing with Git and how to use the git diff command to perform a diff operation. Now you\u2019re equipped with the knowledge you need to start using the git diff command like an expert!<\/p>\n\n\n\n<p>For more learning resources on Git, check out our <a href=\"https:\/\/careerkarma.com\/blog\/what-is-git\/\">How to Learn Git guide<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"The git diff command shows the differences between the files in two commits or between your current repository and a previous commit. This command displays changes denotes by headers and metadata for the files that have changed. When you\u2019re working with the Git version control system, you may want to compare data in your repository&hellip;","protected":false},"author":240,"featured_media":17421,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17286],"tags":[],"class_list":{"0":"post-17420","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-git"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Git","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Git Diff: A How-To Guide: A Step-By-Step Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"The git diff command is used to compare files, commits, and branches in a Git repository. On Career Karma, learn how to use the git diff command.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/git-diff\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git Diff: A How-To Guide\" \/>\n<meta property=\"og:description\" content=\"The git diff command is used to compare files, commits, and branches in a Git repository. On Career Karma, learn how to use the git diff command.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/git-diff\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-01T05:36:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T12:05:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/iphone-notebook-pen-working-34088.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-diff\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-diff\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Git Diff: A How-To Guide\",\"datePublished\":\"2020-12-01T05:36:06+00:00\",\"dateModified\":\"2023-12-01T12:05:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-diff\/\"},\"wordCount\":1413,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-diff\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/iphone-notebook-pen-working-34088.jpg\",\"articleSection\":[\"Git\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/git-diff\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-diff\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/git-diff\/\",\"name\":\"Git Diff: A How-To Guide: A Step-By-Step Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-diff\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-diff\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/iphone-notebook-pen-working-34088.jpg\",\"datePublished\":\"2020-12-01T05:36:06+00:00\",\"dateModified\":\"2023-12-01T12:05:04+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"The git diff command is used to compare files, commits, and branches in a Git repository. On Career Karma, learn how to use the git diff command.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-diff\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/git-diff\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-diff\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/iphone-notebook-pen-working-34088.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/iphone-notebook-pen-working-34088.jpg\",\"width\":1020,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-diff\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Git\",\"item\":\"https:\/\/careerkarma.com\/blog\/git\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Git Diff: A How-To Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Git Diff: A How-To Guide: A Step-By-Step Guide | Career Karma","description":"The git diff command is used to compare files, commits, and branches in a Git repository. On Career Karma, learn how to use the git diff command.","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:\/\/careerkarma.com\/blog\/git-diff\/","og_locale":"en_US","og_type":"article","og_title":"Git Diff: A How-To Guide","og_description":"The git diff command is used to compare files, commits, and branches in a Git repository. On Career Karma, learn how to use the git diff command.","og_url":"https:\/\/careerkarma.com\/blog\/git-diff\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-12-01T05:36:06+00:00","article_modified_time":"2023-12-01T12:05:04+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/iphone-notebook-pen-working-34088.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/git-diff\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/git-diff\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Git Diff: A How-To Guide","datePublished":"2020-12-01T05:36:06+00:00","dateModified":"2023-12-01T12:05:04+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/git-diff\/"},"wordCount":1413,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/git-diff\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/iphone-notebook-pen-working-34088.jpg","articleSection":["Git"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/git-diff\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/git-diff\/","url":"https:\/\/careerkarma.com\/blog\/git-diff\/","name":"Git Diff: A How-To Guide: A Step-By-Step Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/git-diff\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/git-diff\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/iphone-notebook-pen-working-34088.jpg","datePublished":"2020-12-01T05:36:06+00:00","dateModified":"2023-12-01T12:05:04+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"The git diff command is used to compare files, commits, and branches in a Git repository. On Career Karma, learn how to use the git diff command.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/git-diff\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/git-diff\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/git-diff\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/iphone-notebook-pen-working-34088.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/iphone-notebook-pen-working-34088.jpg","width":1020,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/git-diff\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Git","item":"https:\/\/careerkarma.com\/blog\/git\/"},{"@type":"ListItem","position":3,"name":"Git Diff: A How-To Guide"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/17420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=17420"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/17420\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/17421"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=17420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=17420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=17420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}