GIT 从分支本身结帐到 master 更新了我的本地存储库

GIT checkout to master from branch itself updated my local repository

我创建了一个新分支并从我的本地存储库中删除了一个文件。然后签入我的主人合并我的分支。但是在结帐过程中,存储库会更新,当尝试合并我的分支时,它说 'Already up-to-date'

C:\git\junit [cleanup +0 ~0 -1]> git rm '*.md'
rm 'README.md'
C:\git\junit [cleanup +0 ~0 -2]> git checkout master
D       README.md
D       target/surefire-reports/com.tester.webdriver.MyFristTest.txt
Switched to branch 'master'
**Your branch is up-to-date with 'origin/master'.**
C:\git\junit [master +0 ~0 -2]> git merge cleanup
Already up-to-date.

问题是您在切换到 master 分支之前忘记了 git commit 您的更改。 Git 不知道更改属于哪里,所以它只是假设更改是针对您当前所在的分支 in.If 您指定一个分支到应该记录这些更改的地方,合并是可能的.