Git checkout does not change anything

前端 未结 4 541
暗喜
暗喜 2020-12-30 18:47

I really like git. At least, I like the idea of git. Being able to checkout my master project as a separate branch where I can change whatever I want without risk of screw

4条回答
  •  被撕碎了的回忆
    2020-12-30 19:09

    $ git branch
    * master
    $ git checkout -b develop
    $ git branch
      master
    * branch
    

    Now change whatever you want and do git add .

    $ git add .   <--Here is the source of the problem, always git add . at your branch to see the observable difference between two branches.
    $ git commit -m "Some messages"
    
    $ git checkout master
    $ git branch
    *master
    develop
    

    Everything is neat and clean.

提交回复
热议问题