git checkout <branch> -- path/to/file
By the above command, you can pickup files to copy to another branch.
For example,
- You've been coding on branch-A for a long time.
- You wanna open a PR from some files of them.
- Then, execute:
# Switch back to main git checkout main # Create and switch git checkout -b branch-B # Import subset files to branch-B git checkout branch-A -- path/to/file
Top comments (0)