V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
kaminic
V2EX  ›  git

一个奇怪的 git 问题

  •  
  •   kaminic · 2017-08-08 18:07:27 +08:00 · 2649 次点击
    这是一个创建于 2452 天前的主题,其中的信息可能已经有所发展或是发生改变。
    ➜ android git:(feature-new-ui) ✗ git status -s
    ➜ android git:(feature-new-ui) git checkout develop
    Switched to branch 'develop'
    Your branch is ahead of 'origin/develop' by 1 commit.
    (use "git push" to publish your local commits)
    ➜ android git:(develop) git status -s
    ➜ android git:(develop) git checkout feature-new-ui
    Switched to branch 'feature-new-ui'
    Your branch is ahead of 'origin/feature-new-ui' by 2 commits.
    (use "git push" to publish your local commits)
    ➜ android git:(feature-new-ui) ✗ git status -s
    D ByteParser/build.gradle
    D ByteParser/src/main/java/com/nd/byteparser/ByteParser.java

    当前分支是 feature-new-ui 是干净的,
    从 feature-new-ui 切到 develop, develop 也是干净的,
    再从 develop 切到 feature-new-ui
    这时,多了两条文件发生变化的记录,
    这是什么原因???
    第 1 条附言  ·  2017-08-08 20:55:10 +08:00
    在 feature-new-ui 分支里 reset hard 到 HEAD 解决了,下次再来回切分支又出现了
    5 条回复    2017-08-09 15:16:30 +08:00
    jesse_luo
        1
    jesse_luo  
       2017-08-08 23:29:32 +08:00
    大小写?
    majinjing3
        2
    majinjing3  
       2017-08-09 00:40:54 +08:00 via Android
    .gitignore 引起的吧,
    kaminic
        3
    kaminic  
    OP
       2017-08-09 09:49:48 +08:00
    @majinjing3 不是.gitignore
    TimRChen
        4
    TimRChen  
       2017-08-09 10:38:35 +08:00
    切到 feature-new-ui 分支时,有两个 commit,你应该 git stash 暂存,然后再切回
    kaminic
        5
    kaminic  
    OP
       2017-08-09 15:16:30 +08:00
    @TimRChen 暂存是对于不干净的工作区来说的,我的工作区已经是干净的了,两个 commit 是说我本地有两个 commit 没有 push
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3351 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 12:25 · PVG 20:25 · LAX 05:25 · JFK 08:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.