Master updated alone with the checkout

Asked

Viewed 46 times

0

Good morning, everyone! I was working on a branch and when I ran the checkout for master (git checkout master) it updated without me doing the merge. The following message appears:

abel@abel-Vostro-3500:~/Documentos/Drapp/front-web$ git checkout master
M       src/app/pages/painel/doctor/new/new.component.html
M       src/app/pages/painel/doctor/new/new.component.ts
M       src/environments/environment.ts
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
abel@abel-Vostro-3500:~/Documentos/Drapp/front-web$ 

Someone knows how to fix this?

  • What exactly did you want to do?

  • I was working on a branch and had finished what I had to do on it, but I didn’t commit, I immediately ran git checkout master because from master I would create another Feature to do something else. then it appeared in the master

  • 1

    Have you tried to do the checkout to the other branch and commit? master didn’t update itself, you just took the changes to it...

  • In that case you would have to commit before switching to master or running the correct git stash?

  • 1

    Yes, I would have to commit... what I recommend is to always check out another branch before starting to develop

  • Right!!! Thank you!

Show 1 more comment

1 answer

1


Whenever doing the merge in question commit before.

git commit -m "{o que você fez}" 

If you need to change branch before moving up to master (good practice). Use the:

git checkout -b feature/{nome-da-sua-feature}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.