Check out the branch where you want to replace the file: Make sure you’re on the branch that you want to update with the file from another branch.

git checkout <target-branch>

Replace the file with the version from the desired branch: Use the git checkout command to check out the specific file from the other branch.

git checkout <source-branch> -- <path-to-file>

Stage the change: Stage the file for commit.

git add <path-to-file>

Commit the change: Commit the change with a descriptive message.

git commit -m "commit message"