{"id":26339,"date":"2019-08-20T16:43:33","date_gmt":"2019-08-20T20:43:33","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=26339"},"modified":"2019-08-20T16:43:33","modified_gmt":"2019-08-20T20:43:33","slug":"git-2-23","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2019\/08\/20\/git-2-23\/","title":{"rendered":"Git 2.23"},"content":{"rendered":"<p><a href=\"https:\/\/github.blog\/2019-08-16-highlights-from-git-2-23\/\">Taylor Blau<\/a>:<\/p>\n<blockquote cite=\"https:\/\/github.blog\/2019-08-16-highlights-from-git-2-23\/\"><p>It turns out <code>git checkout<\/code>can do quite a lot. You can use it to change branches with <code>git checkout &lt;branch&gt;<\/code> or if you supply <code>--branch<\/code>, create a new branch (as in <code>git checkout --branch &lt;new-branch&gt;<\/code>). If you don&rsquo;t want to switch branches, don&rsquo;t worry, because <code>git checkout<\/code> can change individual files, too.  If you write <code>git checkout -- &lt;filename&gt;<\/code>, you will reset <code>&lt;filename&gt;<\/code> in your working copy to be equivalent with what&rsquo;s in your index. If you don&rsquo;t want to take changes from the index, you can specify an alternative source with <code>git checkout [treeish] -- &lt;filename&gt;<\/code>.<\/p><p>The new commands, by contrast, aim to clearly separate the responsibilities of <code>git checkout<\/code> into two narrower categories: operations which change branches and operations which change files. To that end, <code>git switch<\/code> takes care of the former, and <code>git restore<\/code> the latter.<\/p><\/blockquote>\n\n<p>See also: <a href=\"https:\/\/public-inbox.org\/git\/xmqqy2zszuz7.fsf@gitster-ct.c.googlers.com\/\">Junio C Hamano<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Taylor Blau: It turns out git checkoutcan do quite a lot. You can use it to change branches with git checkout &lt;branch&gt; or if you supply --branch, create a new branch (as in git checkout --branch &lt;new-branch&gt;). If you don&rsquo;t want to switch branches, don&rsquo;t worry, because git checkout can change individual files, too. If [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2019-08-20T20:43:35Z","apple_news_api_id":"60f7bee9-1aca-4e83-ae48-db4e972fff46","apple_news_api_modified_at":"2019-08-20T20:43:38Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AYPe-6RrKToOuSNtOly__Rg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[377,71,376],"class_list":["post-26339","post","type-post","status-publish","format-standard","hentry","category-technology","tag-git","tag-programming","tag-versioncontrol"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=26339"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26339\/revisions"}],"predecessor-version":[{"id":26340,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26339\/revisions\/26340"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=26339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=26339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=26339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}