zoukankan      html  css  js  c++  java
  • git checkout not discard changes

    1. checkout one branch, show status

    user@vbox:/mnt/tmp$ git checkout master
    Switched to branch 'master'
    user@vbox:/mnt/tmp$ git status
    # On branch master
    # Changes not staged for commit:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #       modified:   testfile.c
    #
    no changes added to commit (use "git add" and/or "git commit -a")

    2. show diff, turns out no diff
    user@vbox:/mnt/tmp$ git diff

    user@vbox:/mnt/tmp$

    3. checkout modified file, show status, testfile.c doesn't change.

    user@vbox:/mnt/tmp$ git checkout -- testfile.c

    user@vbox:/mnt/tmp$ git status
    # On branch master
    # Changes not staged for commit:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #       modified:   testfile.c
    #
    no changes added to commit (use "git add" and/or "git commit -a")

    4. solution. Don't know why, but this works for me.
    user@vbox:/mnt/tmp$ git add testfile.c
    user@vbox:/mnt/tmp$ git status
    # On branch master
    nothing to commit, working directory clean
    user@vbox:/mnt/tmp$

  • 相关阅读:
    mysql的权限定义
    数据库的启动流程和关闭介绍/mysql初始化配置文件
    SQL 执行顺序
    AJAX 同步请求锁浏览器
    JSON
    Json.NET
    JSON.parse()和JSON.stringify()
    the XMLHttpRequest Object
    命名方式
    varchar 和 nvarchar 的区别和使用
  • 原文地址:https://www.cnblogs.com/hfyinsdu/p/3725591.html
Copyright © 2011-2022 走看看