Hey guys

Sometimes I tend to forget to commit changes before I checkout another branch 
and the following scenario happens (via cli on windows [with git bash]):

1. I checkout a branch, without having commited first
    > git checkout dev
2. I get this error message:
    > error: Your local changes to the following files would be overwritten by 
checkout:
    > // List of files
    > // ..
    > //
    > Please commit your changes or stash them before you switch branches.

But I would rather prefer a scenario like this:

1. I checkout a branch, without having commited first
    > git checkout dev
2. I get a message like this:
    > Your local changes to the following files would be overwritten by 
checkout:
    > // List of files
    > // ..
    > //
    > Would you want to commit first? (y/n))

IF y --> prompt for commit message and commit automatically
IF n --> display error message: "Please commit your changes or stash them 
before you switch branches"

This would be a faster/ more productive way to handle this error.

I think it wont be a big challenge, you just should put a message in the 
cli-tool when this error occurs and call the commit functionality if "y" is 
pressed. If you'd like I'll even consider doing it myself. If you have some 
documentation or some tipps on where to look for it.

Cheers

Ninivaggi Mattia

Reply via email to