我有一个很大的代码差异需要审核,但它确实应该分成两个独立的差异。
每个diff都有许多提交,我可以找出哪个(大多数)将提交字符串拆分为两个不同的任务,尽管更清晰的拆分将基于文件名(即N个文件关联w) / task-1,M个其他文件与task-2相关联。
有没有一种简单的方法(通过提交或文件)?谢谢!
答案 0 :(得分:3)
有没有一种简单的方法(通过提交或文件)?谢谢!
您应该为此目的使用补丁。
[git format-patch][1]
# first checkout the desired commit that you want to use
# or stay on the desired branch itself
git checkout commit_id
# now create patch for the desired diff tree you want
# This command will create a **single** patch file with all the diffs
# in the given range. (X commits back)
git format-patch HEAD~X --stdout > patch_file.patch
# or if you need the full branch history use the branch name
git format-patch <branch name> --stdout > patch_file.patch
答案 1 :(得分:0)
一个简单的解决方案(虽然代码向导&我猜测是更好的做法):
get checkout mybranch
git rm --cached <filefornewbranch1>
git rm --cached <filefornewbranch2>
...
arc diff
git checkout -t -b newbranch
git add <filefornewbranch1>
git add <filefornewbranch2>
...
arc diff