How to uncommit files that were committed long time a ago?
Note: Since all changes in the current working directory are very important, they should not be affected!

1. Reset the repository into a committed state, but does not affect the current working directory and index(staging) tree.
git reset --soft [commit - hash]

2. Unstage all changed files
git reset HEAD --

3. Add the file you want to commit
git add [filename]

4. Add the changes into repos
git commit -m "something"

Useful command:
git log | grep Jingwei -B 5

How to reset a file into the state of a certain commit?
git checkout [commit - hash] [filename]
Note: the checkout here is quite confusing. it it requires - _ -

Open a new code review

git stash && git pull --rebase && git stash pop
post-review

Useful links:
http://git-scm.com/docs/git-reset

The theory of git rest:
http://www.tigraine.at/2010/09/15/git-unstaging-all-changes-and-reset-the-working-tree

The display lines for grep command
http://stackoverflow.com/questions/9081/grep-a-file-but-show-several-surrounding-lines

最新文章

  1. [转]oracle 分析函数over
  2. python接收图片变成缩略图
  3. MongoDB3.0.x版本用户授权配置(单机环境)
  4. [CareerCup] 1.8 String Rotation 字符串的旋转
  5. socket() failed (13: Permission denied) while connecting to upstream
  6. ogistic regression (逻辑回归) 概述
  7. xcodebuild和xcrun实现自动打包iOS应用程序
  8. Activiti源码浅析:Activiti的活动授权机制
  9. 【MongoDB】The Access control of mongodb
  10. TP-LINK wr703n openwrt 挂载 U盘
  11. is,as,sizeof,typeof,GetType
  12. Java Web项目(Extjs)报错四
  13. AngularJs 学习笔记(一)作用域
  14. RAM和Flash区别
  15. 使用select的str_cli函数的实现
  16. 微信支付WxpayAPI_php_v3 错误修改
  17. js 学习
  18. [Unity动画]05.Entry & Exit & Any State
  19. Python入门之os.walk()方法
  20. Python 字典的嵌套

热门文章

  1. 还在用ListView?
  2. JAVA中的static修饰的方法不能被重写
  3. 为什么选择我--ReactJS
  4. 【转】Angularjs Controller 间通信机制
  5. 游标中的static参数
  6. rdlc报表
  7. 解决kernel headers报错
  8. iOS开发UI篇——Button基础
  9. 添加Appicon的方法
  10. WampServer修改端口及菜单Localhost