git单文件版本恢复
2017-02-09 本文已影响76人
EldonZhao
-
确认需要恢复的版本号:

-
恢复文件到对应版本:
eldon@ubuntu:~/github/ColusLifeDemo/Browser$ git reset fc7237c8c0e13f20b0be97a57ed2b707e54532c3 app/index.html
Unstaged changes after reset:
M Browser/app/index.html
-
确认恢复内容:
eldon@ubuntu:~/github/ColusLifeDemo/Browser$ git reset 90b911c98a67237cd9c31ecee74c3bea2dca9767 app/index.html
Unstaged changes after reset:
M Browser/app/index.html
eldon@ubuntu:~/github/ColusLifeDemo/Browser$ git checkout app/index.html
eldon@ubuntu:~/github/ColusLifeDemo/Browser$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: app/index.html
eldon@ubuntu:~/github/ColusLifeDemo/Browser$ git diff app/index.html
-
提交代码:
eldon@ubuntu:~/github/ColusLifeDemo/Browser$ git commit -a
[master 71abf0e] Solve missing amap problem
1 file changed, 4 insertions(+)
eldon@ubuntu:~/github/ColusLifeDemo/Browser$ git push