title: How to pack commits in git
body: <p>I have two branches branchA and branchB. On branchA, I committed several times. Now I want to pack all commits on branchA from sometime and apply to branchB.</p>
  
  <h2>Update</h2>
  
  <p>To my understanding, <code>merge</code> will apply all commits in branchA to branchB, but I just want to pack some commits, say the latest five commits in branchA. </p>
  
  <p>And I also know that I can use <code>cherry-pick</code> to migrate commit one by one, but I'd like to pack them.</p>