Git_Git基础命令_第8课_重写历史记录

来源:互联网 发布:广发期货软件下载 编辑:程序博客网 时间:2024/06/05 16:20
重写历史记录

涉及到的命令:

git commit --amend

git rebase

git reset

git reflog




命令: git commit --amend


#产生一个新提交替换掉当前所指向的提交

#相当于进行了一次提交,但是提交号还是最后一次的提交号

git commit --amend





==============================



命令: git rebase


#超强的历史修改能力.这里研究线性修改

git rebase



git rebase --continue


#合并分支 ???

git rebase branchName 





===============================



命令: git reset



#根据 git reflog 移动头指针使其回到之前的 提交点

git reset --hard HEAD@{5} 



#还原工作区与暂存区

git reset --hard 



#还原暂存区,HEAD与分支名引用指向commit

git reset --mixed(默认参数) 



#HEAD与分支名引用指向commit

git reset --soft 







========================


命令:git reflog



#维护了HEAD引用的历史信息

git reflog

0 0
原创粉丝点击