git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
kaminic
V2EX  ›  git

一个奇怪的 git 问题

  •  
  •   kaminic · Aug 8, 2017 · 3579 views
    This topic created in 3205 days ago, the information mentioned may be changed or developed.
    ➜ 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
    这时,多了两条文件发生变化的记录,
    这是什么原因???
    Supplement 1  ·  Aug 8, 2017
    在 feature-new-ui 分支里 reset hard 到 HEAD 解决了,下次再来回切分支又出现了
    5 replies    2017-08-09 15:16:30 +08:00
    jesse_luo
        1
    jesse_luo  
       Aug 8, 2017
    大小写?
    majinjing3
        2
    majinjing3  
       Aug 9, 2017 via Android
    .gitignore 引起的吧,
    kaminic
        3
    kaminic  
    OP
       Aug 9, 2017
    @majinjing3 不是.gitignore
    TimRChen
        4
    TimRChen  
       Aug 9, 2017
    切到 feature-new-ui 分支时,有两个 commit,你应该 git stash 暂存,然后再切回
    kaminic
        5
    kaminic  
    OP
       Aug 9, 2017
    @TimRChen 暂存是对于不干净的工作区来说的,我的工作区已经是干净的了,两个 commit 是说我本地有两个 commit 没有 push
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   992 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 19:05 · PVG 03:05 · LAX 12:05 · JFK 15:05
    ♥ Do have faith in what you're doing.