title: Git bash help to pick changes and continue till end
body: <p>I have branches A and B in git. Here I am cherry picking changes from branch A to branch B. For this I have created a tag in branch A and made 10 different commits on top of it. The first commit has been tagged in branch A.</p>
  
  <p>Git cherry pick command takes commit hashes as input. </p>
  
  <p>For this I have a list of commit hashes (SHA) starting from a tag (in  branch A) in a variable like this. </p>
  
  <p>Checkout branch A</p>
  
  <pre><code>commithash="$(/usr/bin/git log --boundary --pretty=oneline ${tag_name}.. | sed -e 's/- //'| cut -d ' ' -f 1)"
  
  echo $commithash  ---gives spaces delimited commit hashes below. 
  
  3f899d3eebce23ce6a1efd3b73ea0b328c8cf3e1 2180e9e8a0a73a5313e70317a20360e3314b2568 f001ad3d03b6a4231d370a3b389d6edbd14db73b 66049c094a0780df7a518ba75d677213168e5211 3a6e53426e85f36b8fc3e19586c18d1ee0abf31b 0b2698bf67ea0c29f0e76fe110a0b89ccbfdecd2 8aed2c998dcd38ac5e01be5d1004d7130b1b2458 07a65386ad8883bf5f774541461cce0779d8b0d2 b57d0d1cea1cf8a151f1244c30b8f08eb7583926
  </code></pre>
  
  <p>I now switch to branch B</p>
  
  <p>For each commit hash in that variable I want to run the command. </p>
  
  <pre><code>git cherry-pick --strategy-option theirs $(for-each-commit-sha)
  </code></pre>
  
  <p>When running the command it is successful except for a below scenario where it fails. </p>
  
  <p>A. if the output for cherry pick command has the below output the script fails and none of the file are cherry picked. </p>
  
  <pre><code>error: could not apply 34h5432.. adding dev text for cc in file
  hint: after resolving the conflicts, mark the corrected paths
  hint: with 'git add &lt;paths&gt;' or 'git rm &lt;paths&gt;'
  hint: and commit the result with 'git commit'
  </code></pre>
  
  <p>Below is the output of:</p>
  
  <pre><code>git status 
  
  On branch B
  You are currently cherry-picking commit 34h5432...
    (fix conflicts and run "git cherry-pick --continue")
    (use "git cherry-pick --abort" to cancel the cherry-pick operation)
  
  Unmerged paths:
    (use "git add/rm &lt;file&gt;..." as appropriate to mark resolution)
  
      deleted by us:   cc.txt
  </code></pre>
  
  <p>In this scenario I want to run git add cc.txt or issue a git add for whatever is mentioned after "deleted by us: " </p>
  
  <pre><code>git add cc.txt 
  
  git commit -m "adding file" 
  </code></pre>
  
  <p>Then continue cherry pick for rest of the commit hashes in the list until the last. </p>
  
  <p>The cherry pick needs to be done from last commit sha to first. In this case start with <code>b57d0d1cea1cf8a151f1244c30b8f08eb7583926</code> and ends with 
  <code>3f899d3eebce23ce6a1efd3b73ea0b328c8cf3e1</code></p>
  
  <p>How can I do that ? </p>
  
  <pre><code>commithash="$(/usr/bin/git log --boundary --pretty=oneline ${tag_name}.. | sed -e 's/- //'| cut -d ' ' -f 1)"
  </code></pre>