gpt4 book ai didi

git difftool --dir-diff : how to copy back changed files

转载 作者:太空狗 更新时间:2023-10-29 14:32:51 25 4
gpt4 key购买 nike

我使用 git-diffall之前,但是作者说it was obsolete通过 git difftool --dir-diff 命令。

命令 git difftool --dir-diff 无法复制我在 difftool 中更改的代码,如 git-diffall's --copy-back option do .

我在网上搜索了一下,只找到这个,看起来很复杂……:

[PATCH] difftool --dir-diff: copy back all files matching the working tree

当你使用 difftool 并对代码进行一些更改时,你会做什么?

谢谢

最佳答案

The command git difftool --dir-diff cannot copy back what I change code in the difftool which like git-diffall's --copy-back option do.

修改后的文件会被复制回来,只要你比较的一侧是工作树。即:

git difftool --dir-diff other-commit

将在左侧显示other-commit,在右侧显示当前工作树中修改的文件。工具退出后,右侧的文件将被复制回您的工作树。 (使用 v1.8.3.2 测试。)

只有当它们最初是您的工作副本时,才有意义将它们复制回来:从任意差异复制文件会覆盖您的工作树。但是,如果您希望您的工作树是 commit2 的版本,将其与 commit1 进行比较并将这些更改保留在您的树中,您可以通过首先检查那个版本:

git checkout commit2 -- specific-file
git difftool --dir-diff commit1

关于git difftool --dir-diff : how to copy back changed files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21911109/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com