美文网首页GitGit使用
git单文件版本恢复

git单文件版本恢复

作者: EldonZhao | 来源:发表于2017-02-09 11:33 被阅读76次
  • 确认需要恢复的版本号:
待恢复版本号
  • 恢复文件到对应版本:
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

相关文章

  • git单文件版本恢复

    确认需要恢复的版本号: 恢复文件到对应版本: 确认恢复内容: 提交代码:

  • git7~git还原文件到某个版本

    2019.05.10 git还原某个文件到某个版本 git log test.php 找到要恢复的hash git...

  • git命令行

    git reset xxxxxxxxxxxxx 所有文件恢复到某一个历史版本git reset xxxxxxxxx...

  • Git笔记

    Git笔记 创建Git仓库: 将文件添加到暂存区 将文件修改提交到版本库 版本库更新流程 撤销 恢复上一版本 查看...

  • git revert 某一个文件

    记录下需要恢复的commit版本号:如 xxx commitid 恢复该文件:git reset commitId...

  • git恢复文件到指定版本

    恢复某个文件到指定的提交 查询提交日志 要恢复到哪个版本就执行git checkout 版本id(只需要前4位) ...

  • 考考你的 Git 掌握情况

    .什么是Git Git 是分布式版本控制系统(DVCS)。它可以跟踪文件的更改,并允许你恢复到任何特定版本的更改。...

  • Git 常用命令总结

    GIT 工作区 状态 记录 恢复文件到修改前版本 分支操作 提交和推送 工作现场 标签

  • Git: 版本控制(6)

    恢复文件的历史版本git revert 创建一个 css 目录,添加一个 index.css 文件,在 index...

  • Git常用命令

    版本回退git reset 回退add 操作Git 版本恢复还原命令 reset git reset –mixed...

网友评论

    本文标题:git单文件版本恢复

    本文链接:https://www.haomeiwen.com/subject/tadiittx.html