我尝试下面的命令外壳上git的结帐自动合并本地修改
git init
echo "test1" > test1.txt
git add test1.txt
git commit -a -m "test1"
echo "test2" >> test1.txt
git branch test
git checkout test
text.txt
现在包含:
test1
test2
结账后分支从master
获得合并test
所有本地修改。
为什么?
我预计git
拒绝结帐到test
由于本地的变化。我希望git要求提交或本地更改。
编辑: 我用一个bash脚本来执行这个命令。我得到以下输出:
[email protected]:/tmp/test$ ./createrepo
Initialized empty Git repository in /tmp/test/.git/
[master (root-commit) 0407f5b] test1
1 file changed, 1 insertion(+)
create mode 100644 test1.txt
M test1.txt
Switched to branch 'test'
我有同样的问题,奇怪的是,对于一些存储库,我无法签出没有提交,其他合并。我查看了配置,看不到任何区别。 – jdborg