the stash command is your friends, basically before you switch to master from 
b1, you do a git stash:

(on b1) $ git stash save -u

this will save all your untracked and unstaged file in b1 in a stash, after 
that you'll be back in a state just like you were when you first branch off of 
master, now you can switch to master and branch off b2. after you finish with 
b2 and merge it to master, you can go back to b1 and do a git stash pop to get 
your stashed changes back in b1. I'm suggesting that you do a 'git merge b2' 
before poping the stash.

so in a nutshell, here's what you can do

(*b1) git stash save -u
(*b1) git checkout master
(*master) git branch -b b2
(*b2) hack or bug fixing and testing…
(*b2) git commit
(*b2) git co master
(*master) git merge b2
(*master) git co b1
(*b1) git merge b2
(*b1) git stash pop

hope that's help  

Rahmat Budiharso
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Saturday, March 2, 2013 at 10:48 PM, Surya wrote:

> I am working of a project "X"
>  
> I created a branch "b1" from "master". I am working on some improvements in 
> "b1". I didn't commit anything. Not even stage!  
>  
> In the middle of the story, I found another bug need to be address soon. So, 
> I thought to create another branch "b2" from Master and work on it, merge it 
> with master, push it to origin.. and later on go back to "b1" job.
>  
> However, when I switched to "master" to create "b2" branch for fixing bug, I 
> found all the "untracked" files of "b1" branch in "master"!! All I thought 
> till now is, until I "merge" or "push", from a branch  I don't practically, 
> change things in "master".. However, I see things now..
>  
> This is stopping me to create "b2" branch from master to work on another 
> work.. independent of "b1" work.
>  
>  
> Hope you understand my situation.
>  
> So, the below is summary of above- -- and what I am expecting.. How to do it?
>  
> The "master" is where actual code is..
> "b1" is where I currently work on an issue. Suddenly I need to go for another 
> issue. So, want to create "b2" branch from master to work on it.. However, I 
> am finding untracked files of b1 in master..
>  
> I want to work on b2 issue independent of b1 issue.. and later merge into 
> master, and b1 if its really fixed..  
>  
> How to do this?
>  
>  
> How do people usually happen to deal with this situation ?  
>  
> --  
> 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 
> (mailto:git-users+unsubscr...@googlegroups.com).
> For more options, visit https://groups.google.com/groups/opt_out.
>   
>   

-- 
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.


Reply via email to