gpt4 book ai didi

gitkraken - 在 GitKraken 中恢复一个文件

转载 作者:行者123 更新时间:2023-12-03 06:33:50 28 4
gpt4 key购买 nike

GitKraken 是否可以将单个文件的更改恢复到较早的提交,而不是恢复整个提交?

最佳答案

回答

一个revert从 git 的意义上来说,它只能在提交时执行。它引入了一个新的提交,它完全否定了恢复的提交的更改。请参阅here 。 GitKraken 支持这一点:右键单击提交,Revert <branch> to this commit .

但是,您想要完成的任务可以通过 git checkout 来完成。我认为 GitKraken 还不支持单个文件的这种功能。但是,您可以使用命令行。

通过命令行重置单个文件

git checkout <commit> <file>

Check out a previous version of a file. This turns the <file> that resides in the working directory into an exact copy of the one from <commit> and adds it to the staging area.

可以找到文档 here .

git checkout HEAD~1 <filename>因此,会将单个文件重置为当前 HEAD 之前的提交.

关于gitkraken - 在 GitKraken 中恢复一个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43275419/

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