赞
踩
一切皆引用
当前commit的引用
1 commit 的串儿的引用
2 branch包含从初始commit 到当前commit的所有路径。所以branch也是commit的引用。
3 切换分支也就是切换引用。
4 删除分支也就是删除commits
checkout 的本质是签出指定的 commit,
所以你不止可以切换 branch,
也可以直接指定 commit 作为参数,
来把 HEAD 移动到指定的 commit。
git checkout < commit D >
Note: checking out 'ecc98f00bc43638e4200d3dde9284caf5b39860b'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
此时 .git/HEAD 文件的内容为 ecc98f00bc43638e4200d3dde9284caf5b39860b
也就是当前checkout 的 commit
git checkout -b oldmaster
参考branch
git rebase -i HEAD^
git rebase -i commitID
本质: 基于分支的变基 和 基于commit的变基本质相同。
git revert <commit-ID>
git reflog
git checkout <reflog-Id>
git checkout -b <newBranchName>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。