Doubt about git and create branches

2

I have a git project where I have the develop and master branch. I created a new branch with the command "git checkout -b feature / feature_test"

Then I enter this branch and edit a file that is "carController.php". In between I want to make another feature (branch) to do something else and upload the changes.

For this, what I do is go to the branch of develop with the command "git checkout develop" but when doing this command git tells me

dani@pc:~/Projects/test$ git checkout develop
M       carController.php
Switched to branch 'develop'
Su rama está actualizada con «origin/develop».

And from there I launch another feature with the command "git checkout -b feature / feature_Pruebas2"

This is what this file is dragging ... to not do this and to be able to treat the features separately that a stash of those files should do?

Thanks

    
asked by edica 19.09.2018 в 18:42
source

1 answer

1

If in the feature/feature_Pruebas branch you modified carController.php you should commit it before changing branches.

git commit carController.php -m "modifica carController por motivos X"
git checkout develop
git checkout -b feature/feature_Pruebas2

And eye, here I am not considering that you may want to push the changes to the remote before changing branches.

    
answered by 19.09.2018 в 19:07