Questa domanda è simile a questa , ma più specifica.
Ho un progetto con due rami ( staginge beta).
Sviluppo staginge utilizzo il masterramo per correggere i bug. Quindi, se sto lavorando allo staging e vedo un errore, cambio in masterbranch:
git checkout master
e fai le cose:
git add fileToAdd
git commit -m "bug fixed"
e poi mi unisco con entrambi i rami:
git checkout staging
git merge master
git checkout beta
git merge beta
E non importa se ci sono altri file sull'albero di lavoro.
Ma ora, quando provo a passare al masterramo, ricevo un errore :
error: Your local changes to the following files would be overwritten by checkout:
src/Pro/ConvocationBundle/Controller/DefaultController.php
Please, commit your changes or stash them before you can switch branches.
Aborting
Ho pensato di dover rimuovere il file dall'area di staging:
git reset HEAD src/Pro/ConvocationBundle/Controller/DefaultController.php
ma ricevo lo stesso errore. Se git statuslo ottengoNo changes to commit
git add your-filee impegnati.
staging.
reset --hard? Se sei davvero sicuro di voler annullare le modifiche. Oppure usa la scorta se non lo fai.