{"id":675,"date":"2011-01-20T02:42:04","date_gmt":"2011-01-20T09:42:04","guid":{"rendered":"http:\/\/sp2hari.com\/?p=675"},"modified":"2020-06-20T08:27:48","modified_gmt":"2020-06-20T08:27:48","slug":"compare-branches-in-git","status":"publish","type":"post","link":"https:\/\/sp2hari.com\/index.php\/2011\/01\/20\/compare-branches-in-git\/","title":{"rendered":"Compare branches in git"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sp2hari.com\/wp-content\/uploads\/2011\/01\/git.jpg\" alt=\"\" title=\"git\" width=\"100\" height=\"100\" class=\"alignright size-full wp-image-710\">Want to check if all changes in your new branch is merged to main branch before you delete the new branch.<\/p>\n<p><code>git log feature1 ^master <\/code><\/p>\n<p>The above command displays all commits which are present in feature1 and not present in master.<\/p>\n<p>Note 1: You can also try &#8220;git branch -d feature1&#8221;. If the new branch is not totally merged, git won&#8217;t delete the new branch.<\/p>\n<p>Note 2: You can also try &#8220;git branch &#8211;contains feature1&#8221;, but I&#8217;m not sure how that works. I guess I&#8217;m happy with git log for now.<\/p>\n<p>To read more about this, checkout <a href=\"http:\/\/stackoverflow.com\/questions\/1710894\/using-git-show-all-commits-that-are-in-one-branch-but-not-the-others\">http:\/\/stackoverflow.com\/questions\/1710894\/using-git-show-all-commits-that-are-in-one-branch-but-not-the-others<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Want to check if all changes in your new branch is merged to main branch before you delete the new branch. git log feature1 ^master The above command displays all commits which are present in feature1 and not present in master. Note 1: You can also try &#8220;git branch -d &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-675","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/comments?post=675"}],"version-history":[{"count":15,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/675\/revisions"}],"predecessor-version":[{"id":1349,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/675\/revisions\/1349"}],"wp:attachment":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/media?parent=675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/categories?post=675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/tags?post=675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}