Thanks for your answer and for the link, i'll have a look but i fear i'm still too much newbie to manipulate custom scripts; i'll keep it away for a rainy day. Meanwhile i'll have to accept the logic in which git flows, even if it sounds illogical to me.
On Thursday, February 14, 2013 1:44:24 PM UTC+1, Thomas Ferris Nicolaisen wrote: > > On Thursday, February 14, 2013 10:02:29 AM UTC+1, Fabrizio Cioni wrote: > >> Example: >> 1) I'm working on branch "newfeatures" and i've edited some files >> 2) the customer call and warn me of a bug requiring a quick fix >> 3) i switch from "newfeatures" to "master" and i create a branch >> "fix_2000" from master; while doing this i forget to commit on >> "newfeatures", what i'm working on doesn't conflict with master so i'm >> allowed to carry my editing to "fix", and then commit a mixed up bag with >> horrible results. >> >> I know that when i switch from a branch to another i get a list of the >> pending changes but... is there a config to set so that i can block "git >> checkout" while there is at least a change pending (being it added file - >> modified or deleted) ? >> I don't understand why the existing logic allows it, but i clearly see >> how a distracted/in a rush/sleepless developer can make a mess of it; still >> recoverable but very time-consuming when you find it x days later. >> >> Thanks for your help, >> Fabrizio >> > > The logic is fine. I often have cases where I want to bring changes to the > work tree over in another branch. Actually I think it would be rather > cumbersome if it was the other way around. > > You could make a hook script in .git/hooks/post-checkout that does some > checking on the output of `git status` - and print a big warning message if > you have local changes. > > Here's an elaborate script I just found quickly, you might be able to > adapt it to your needs: https://gist.github.com/gurglet/1780139 > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.