更新时间:2023-11-27 23:52:34
从您希望文件结束的分支运行:
Run this from the branch where you want the file to end up:
git checkout otherbranch myfile.txt
通用公式:
git checkout <commit_hash> <relative_path_to_file_or_dir>
git checkout <remote_name>/<branch_name> <file_or_dir>
一些笔记(来自评论):
Some notes (from comments):
myfile.txt
和 mydir
另一种选择:
git show commit_id:path/to/file > path/to/file