admin管理员组

文章数量:1297014

I have a Git repository with multiple branches, and I need to clone it to my local machine. My goal is to extract only the files that were changed in each Pull Request (PR) and copy them to a separate folder.

For example, let's say there's a branch named test, and the following files were modified in a PR:

  • README.md
  • a.out
  • test.txt

I want to extract only these changed files into a separate directory.

My Environment:

  • OS: Windows 11
  • Git Version: 2.47.1.windows.2

Question:

What is the best way to extract only the changed files in a PR and copy them into a separate folder on Windows? Are there any alternative approaches or Git commands that work better in this scenario?

Any help would be appreciated!

I tried some commands like

git diff --name-only origin/master..origin/topic/bug_fixes > diff.txt

and extract the changed files manually by referring to the diff.txt (Which is time consuming)

本文标签: windowsHow to Extract Only Changed Files from a PR After Cloning a Git RepositoryStack Overflow