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