{"id":3534,"date":"2016-03-30T20:58:20","date_gmt":"2016-03-30T20:58:20","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3534"},"modified":"2016-03-30T20:58:20","modified_gmt":"2016-03-30T20:58:20","slug":"unstage-list-changes","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/unstage-list-changes\/","title":{"rendered":"Unstaging a list of files in git"},"content":{"rendered":"<p>When merging I find it helpful sometimes to un-stage all changes with conflicts. This allows you to commit changes without conflicts, and then resolve the conflicts as a separate step.<\/p>\n<p>If you do a cherry pick:<\/p>\n<pre lang=\"bash\">\ngit cherry-pick ...insert sha here...\n<\/pre>\n<p>You will see changes that have conflicts, but the parts of the files that don&#8217;t conflict are automatically staged. To undo this, you can get a list of the files with conflicts like so (note this doesn&#8217;t cover files deleted in one repository, but that is typically easier to resolve manually):<\/p>\n<pre lang=\"bash\">\ngit diff --name-only --diff-filter=U \n<\/pre>\n<p>You can then make a shell script that lets you unstage all of these:<\/p>\n<pre lang=\"bash\">\ngit diff --name-only --diff-filter=U | sed \"s\/(.*)\/git reset $1\/\" | unstage.sh\n.\/unstage.sh\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When merging I find it helpful sometimes to un-stage all changes with conflicts. This allows you to commit changes without conflicts, and then resolve the conflicts as a separate step. If you do a cherry pick: git cherry-pick &#8230;insert sha here&#8230; You will see changes that have conflicts, but the parts of the files that &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/unstage-list-changes\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Unstaging a list of files in git&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[79,249,364],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3534"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=3534"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3534\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}