{"id":7135,"date":"2020-06-05T23:43:00","date_gmt":"2020-06-06T03:43:00","guid":{"rendered":"https:\/\/www.jitendrazaa.com\/blog\/?p=7135"},"modified":"2020-07-01T23:52:15","modified_gmt":"2020-07-02T03:52:15","slug":"shell-script-read-all-file-names-in-pull-request","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/others\/linux\/shell-script-read-all-file-names-in-pull-request\/","title":{"rendered":"Shell Script &#8211; Read all file names in Git Pull Request"},"content":{"rendered":"\n<p class=\"justify\">In your<a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/continuous-integration\/\"> CI \/ CD<\/a> process, it could be very common scenario that you need to know name of all files thats part of any pull request. Example- in Salesforce you want to <a href=\"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/auto-generate-package-xml-using-ant-complete-source-code-and-video\/\">perform delta deployment<\/a> with only components that are part of user story.<\/p>\n\n\n\n<p class=\"justify\">Below shell script demonstrates how we can read all file names and iterate through it. For Demo purpose, I&#8217;m just adding white space at end of each file however you can do anything as per you <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/continuous-integration\/\">continuous integration<\/a> pipeline requirement.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# File name - AddWhitespace.sh \n# Read list of all unique file and store as array - 231327\necho &quot;Provide Pull Request Number&quot;\nread prNumber\necho &quot;Your entered $prNumber&quot;\n#Read all files that are part of Git\nfileNames=$(  git log origin\/remoteBranchName --grep &quot;$prNumber&quot;  --pretty=format: --name-only | grep -v -e &quot;^$&quot; | sort | uniq )\n#convert variable to array\nIFS=$&#039;\\n&#039; array=($fileNames) \necho &quot;------ Printing file names&quot;\nfor element in &quot;${array&#x5B;@]}&quot;\ndo   \n    echo &quot;Trying to add White space in $element&quot;\n    printf &quot; &quot; &gt;&gt; $element  \ndone\n<\/pre><\/div>\n\n\n<p>To run above file just use command <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nbash AddWhitespace.sh\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Shell script to read all files part of Pull Request &#038; iterate through them<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[27],"tags":[294,509,108,508],"class_list":["post-7135","post","type-post","status-publish","format-standard","hentry","category-linux","tag-continuous-integration","tag-devops","tag-git","tag-shell-script"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":3902,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/automated-daily-backup-using-ant-migration-tool-and-git\/","url_meta":{"origin":7135,"position":0},"title":"Automated Daily Backup of Salesforce Using ANT Migration Tool and GIT","author":"Jitendra","date":"July 5, 2014","format":false,"excerpt":"In few\u00a0previous articles, I have talked about how to use \"ANT Migration tool in Salesforce\" and \"How to Use EGit plugin in Eclipse to work with Git\". So to make this article short, I assume that you are already familiar with ANT Migration tool provided by Salesforce and Git. During\u2026","rel":"","context":"In &quot;Configuration&quot;","block_context":{"text":"Configuration","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/configuration\/"},"img":{"alt_text":"Salesforce Automated Script for Data Backup Using CommandLine","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/07\/Salesforce-Automated-Script-for-Data-Backup-Using-CommandLine.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/07\/Salesforce-Automated-Script-for-Data-Backup-Using-CommandLine.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/07\/Salesforce-Automated-Script-for-Data-Backup-Using-CommandLine.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5935,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/continuous-integration-ci-in-salesforce-using-team-foundation-server-tfs-video\/","url_meta":{"origin":7135,"position":1},"title":"Continuous Integration (CI) in Salesforce using Team Foundation Server (TFS) &#8211; Video","author":"Jitendra","date":"March 20, 2017","format":false,"excerpt":"Step by step guide to set up Continuous Integration (CI) for Salesforce using Team Foundation Server (TFS) with video tutorial","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Team Foundation Server (TFS) - New Build definition - Select repository","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/Team-Foundation-Server-TFS-New-Build-definition-Select-repository.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/Team-Foundation-Server-TFS-New-Build-definition-Select-repository.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/Team-Foundation-Server-TFS-New-Build-definition-Select-repository.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/Team-Foundation-Server-TFS-New-Build-definition-Select-repository.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4276,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/continuous-integration-in-salesforce-using-jenkins-and-git-video-tutorial\/","url_meta":{"origin":7135,"position":2},"title":"Continuous integration in Salesforce Using Jenkins and Git | Video Tutorial","author":"Jitendra","date":"March 23, 2015","format":false,"excerpt":"As your Salesforce Organization undergoes heavy customization and frequent builds, moving changes from one Sandbox to other sandboxes starts taking longer time and effort. Also, in normal Salesforce project, there are chances that you will have minimum three sandboxes likely Developer Sandbox, QA Sandbox and UAT Sandbox. After some time\u2026","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Salesforce - Jenkins Git Polling Log","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/03\/Salesforce-Jenkins-Git-Polling-Log.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/03\/Salesforce-Jenkins-Git-Polling-Log.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/03\/Salesforce-Jenkins-Git-Polling-Log.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/03\/Salesforce-Jenkins-Git-Polling-Log.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":5274,"url":"https:\/\/www.jitendrazaa.com\/blog\/others\/tips\/frequently-used-git-commands\/","url_meta":{"origin":7135,"position":3},"title":"Frequently Used Git Commands","author":"Jitendra","date":"August 22, 2018","format":false,"excerpt":"Most frequently used Git commands by developers","rel":"","context":"In &quot;Tech Tips&quot;","block_context":{"text":"Tech Tips","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/others\/tips\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":31234,"url":"https:\/\/www.jitendrazaa.com\/blog\/ai\/claude-code-complete-guide-2026-from-basics-to-advanced-mcp-2\/","url_meta":{"origin":7135,"position":4},"title":"Claude Code Complete Guide 2026: From Basics to Advanced MCP, Agents &amp; Git Workflows","author":"Jitendra Zaa","date":"January 25, 2026","format":false,"excerpt":"Master Claude Code in 2026: Complete guide covering installation, MCP servers, subagents, Git workflows, IDE integrations, and advanced configurations.","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/ai\/"},"img":{"alt_text":"Claude Code Complete Guide 2026 - Featured Image","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2026\/01\/claude-code-complete-guide-featured.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2026\/01\/claude-code-complete-guide-featured.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2026\/01\/claude-code-complete-guide-featured.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2026\/01\/claude-code-complete-guide-featured.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2026\/01\/claude-code-complete-guide-featured.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4756,"url":"https:\/\/www.jitendrazaa.com\/blog\/others\/tips\/fix-git-errors-permission-denied-and-cannot-spawn\/","url_meta":{"origin":7135,"position":5},"title":"Fix Git errors : Permission denied , Cannot spawn , No supported authentication methods available","author":"Jitendra","date":"August 6, 2015","format":false,"excerpt":"Recently, I came across few errors of Git and found very time consuming to fix those. Let's discuss what are those errors and how we can fix it. Error : Permission denied (publickey). fatal : could not read from remote repository This error came while trying to push changes to\u2026","rel":"","context":"In &quot;Tech Tips&quot;","block_context":{"text":"Tech Tips","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/others\/tips\/"},"img":{"alt_text":"Pageant Load existing SSH keys","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/08\/Pageant-Load-existing-SSH-keys.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/08\/Pageant-Load-existing-SSH-keys.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/08\/Pageant-Load-existing-SSH-keys.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/7135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=7135"}],"version-history":[{"count":2,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/7135\/revisions"}],"predecessor-version":[{"id":7137,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/7135\/revisions\/7137"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=7135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=7135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=7135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}