Home  >  Q&A  >  body text

git 分支失效问题

不知道怎么回事,git创建新的分支,然后在分支里面修改,结果master也跟着同步改了,不应该是在没合并之前,在分支里面的修改不影响master的吗
这是我的所有分支情况
git branch -a

  dev
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

请问一下这个是什么情况呢

PHP中文网PHP中文网2727 days ago584

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-05-02 09:24:55

    @bordertownmadman I created the branch through git checkout -b. . . I just switched over, and then I created and modified files in the branch. After committing, I returned to master and found that the previously created and modified files were synchronized before they were merged. .
    I cloned it again and created a new branch. It seemed to be fine. I don’t know why--!

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:24:55

    Are you sure you switched branches through checkout after creating the branch?
    If there is no switch, you are still on the original branch

    Look git help branch, there is a sentence

    in it

    the current branch will be highlighted with an asterisk.

    That is, the one marked with an asterisk is the current branch... so you are not currently on the dev 分支上,还是在 master branch.

    reply
    0
  • 为情所困

    为情所困2017-05-02 09:24:55

    Are you sure you committed and then checked out? Did you get the order wrong? Do you checkout first and then commit?

    reply
    0
  • Cancelreply