Hi all - 

you were right I hadn't added and committed the file in the dev branch - 
once I did all went as expected. Thanks for your help!

On Tuesday, September 15, 2015 at 7:58:19 AM UTC+1, Konstantin Khomoutov 
wrote:
>
> On Tue, 15 Sep 2015 08:05:01 +0200 
> Gergely Polonkai <ger...@polonkai.eu <javascript:>> wrote: 
>
> > > > If (locally) in gitbash I 
> > > >  create a new branch e.g. 'dev' 
> > > >    then create a new file: eg touch style.css 
> > > >     then git add, git commit -m "..." 
> > > > 
> > > > and then switch back to master and type ls 
> > > > 
> > > > style.css will be listed there (in the master directory) 
> > > > 
> > > > 
> > > > Is this correct? 
> > > 
> > > No.  Are you sure you have really committed the addition of that 
> > > file? 
> > > 
> > > Because the only two possibilities for that file to be in the work 
> > > tree when you checkout the "master" branch are: 
> > > * The file is also present in the tip commit of that branch; 
> > > * The file is currently untracked. 
> > 
> > The third possibility is that you did this on master: 
> > 
> > $ git branch dev 
> > $ git add style.css 
> > $ git commit 
> > $ git checkout master 
> > 
> > In which case you actually committed style.css on master. Creating a 
> > branch with git-branch doesn't set it as the current one; you have to 
> > explicitly check it out. 
>
> Nice catch, indeed! 
>
> I'd mention then, that if one wants to create a branch and switch to 
> it immediately, a convenient command to do this is 
>
>   git checkout -b newbranch 
>

-- 
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/d/optout.

Reply via email to