git学习补充

关系图

  

 git checkout -- target

  放弃 cached 中 对 target 文件内容已作的修改

  git checkout .

  放弃当前目录下对于 cached 的所有修改。

  对比:git rm <target>删除 cached 中的已 tracked 的整个targe文件

  git branch -d branchname

  删除分支

  git diff

  查看 workspace 与 cached 的差别。

  git diff --cache

  查看 cached 与 local repositorty 的差别。 

  git diff HEAD 

  查看 workspace 和 local repository 的差别。

  git reset –mixed

  此为默认方式,不带任何参数的git reset,它回退到某个版本,只保留工作区,回退 local repositorty 和 cached 信息

  git reset –soft 

  回退到某个版本,只回退了 local repositorty 的信息,不会恢复到 cached 一级。如果还要提交,直接commit即可

  git reset –hard

  彻底回退到某个版本,本地的工作区也会变为上一个版本的内容

  git revert commitID

  回滚到指定的历史版本,HEAD指针前移,即用历史版本重新提交一次(git reset 的 HEAD 指针后移)

  执行 git revert 前必须保证所作的修改已经 commit

猜你喜欢

转载自www.cnblogs.com/tongyishu/p/11696165.html