我有一些代码应该暂时还原,但我稍后会需要它。是否有可能恢复但保留更改的类以供将来使用?
编辑: 我知道,可以将它们移到单独的更改列表中并在提交时忽略。但那不是我需要的。我实际上需要保留两个版本的文件。
谢谢。
答案 0 :(得分:2)
当然这是可行的。
现在你们两个都有!
具体做法是:
git checkout -b 0x1234 // get the old code and create a new branch based on it
git checkout master head // head is the tip of your current master
答案 1 :(得分:0)
您想使用git stash
。不,真的,我知道你已经接受了另一个答案,但请帮自己一个忙,试试git help stash
;您99%的时间使用的两个命令是git stash
和git stash pop
。