小智 10
git checkout可以将路径作为参数,如果给定,则HEAD单独保留,并将这些路径检出到您的工作目录和索引中,因此您可以使用:
git checkout branchname -- .
git diff --name-status HEAD <otherBranch> | grep -e "^A" | cut -f 2 | xargs git checkout <otherBranch> --
Run Code Online (Sandbox Code Playgroud)
做这份工作。