是否可以在GIT提交之间切换?
我目前正在尝试了解git,目前为止,我已经对一个项目进行了2项更改:是否可以在GIT提交之间切换?,git,Git,我目前正在尝试了解git,目前为止,我已经对一个项目进行了2项更改: oshiro@debian:/var/www$ git log commit 4fd249jf039jf49rj905482h794g805h4g53943h Author: oshiro <oshiro@mail.com> Date: Wed Mar 12 15:07:00 2014 +0000 removed junk from initial version commit 39fru4384
oshiro@debian:/var/www$ git log
commit 4fd249jf039jf49rj905482h794g805h4g53943h
Author: oshiro <oshiro@mail.com>
Date: Wed Mar 12 15:07:00 2014 +0000
removed junk from initial version
commit 39fru438439fj3498521490u53945u854u3084ut
Author: oshiro <oshiro@mail.com>
Date: Wed Mar 12 14:53:40 2014 +0000
initial messy project version
oshiro@debian:/var/www$
我是否可以在初始混乱的项目版本和从初始版本删除的垃圾邮件之间切换?只需签出您想要的任何提交即可
git checkout 'commit'
如果您想创建一个分支,而不从初始版本中删除提交垃圾,您可以这样做
git checkout 39fru438439fj3498521490u53945u854u3084ut
git checkout -b new_branch 39fru438439fj3498521490u53945u854u3084ut
如果您想从这个提交中创建一个命名分支,您可以这样做
git checkout 39fru438439fj3498521490u53945u854u3084ut
git checkout -b new_branch 39fru438439fj3498521490u53945u854u3084ut
git签出39fru438439fj3498521490u53945u854u3084ut或任何提交。