可以在GIT提交之间切换吗? [英] Is it possible to switch between GIT commits?
本文介绍了可以在GIT提交之间切换吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在尝试了解git,并且已经对项目进行了两项更改:
oshiro @ debian: / var / www $ git log
commit 4fd249jf039jf49rj905482h794g805h4g53943h
作者:oshiro< oshiro@mail.com>
日期:Wed Mar 12 15:07:00 2014 +0000
从原始版本中删除垃圾
提交39fru438439fj3498521490u53945u854u3084ut
作者:oshiro< oshiro @ mail.com>
日期:Wed Mar 12 14:53:40 2014 +0000
初始凌乱项目版本
oshiro @ debian:/ var / www $
是否有可能在最初的凌乱项目版本和从初始版本中删除的垃圾之间进行切换?
解决方案
如果你想创建一个没有提交的分支从初始版本中删除垃圾,你可以做
git checkout 39fru438439fj3498521490u53945u854u3084ut
如果你想要从这个提交中创建一个命名分支,你可以这样做:
pre $ g $ c $ git checkout -b new_branch 39fru438439fj3498521490u53945u854u3084ut
I am currently trying to learn about git and have committed 2 changes to a project so far:
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$
Is it possible for me to switch between the initial messy project version and removed junk from initial version?
解决方案
If you want to create a branch without the commit "removed junk from initial version", you can do
git checkout 39fru438439fj3498521490u53945u854u3084ut
And if you want to create a named branch out of this commit, you can do
git checkout -b new_branch 39fru438439fj3498521490u53945u854u3084ut
这篇关于可以在GIT提交之间切换吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文