search

Home  >  Q&A  >  body text

git branch failure problem

I don’t know what happened. git created a new branch and then modified it in the branch. As a result, the master was also changed simultaneously. Shouldn’t it be that before the merge, the modifications in the branch did not affect the master?
Here are all my branches
git branch -a

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

Excuse me, what is going on?

PHP中文网PHP中文网2827 days ago655

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