git command tips: git switch branch without checkout

[lake@localhost testgit]$ git branch
* master
  test
[lake@localhost testgit]$ git symbolic-ref HEAD refs/heads/test
[lake@localhost testgit]$ git branch
  master
* test
[lake@localhost testgit]$ ls
master.txt  test.txt
[lake@localhost testgit]$ git status  -s
M  master.txt
A  test.txt
[lake@localhost testgit]$ git reset HEAD  --hard
HEAD is now at c328a3c 1st master
[lake@localhost testgit]$ git status  -s
[lake@localhost testgit]$ ls -l
total 4
-rw-r--r-- 1 lhu3 Porcelain 8 Feb 22 09:07 test.txt
[lake@localhost testgit]$

猜你喜欢

转载自blog.csdn.net/hushui/article/details/113953279