Hi,

git doesn's save changes in a branch. Only commits are saved in an specific
branch. So, if you have a change in a file and change the branch, this
change will be at the new branch. If you don't want it, you need to commit
or stash the change before changing branch.

If changing a branch will cause a conflict of a modified file with a change
in the branch that you want to change, Git you tell you that you need to
commit before changing the branch.


William Seiti Mizuta
@williammizuta
Caelum | Ensino e Inovação
www.caelum.com.br


On Fri, Aug 30, 2013 at 12:21 PM, djsuperfive <maximefresch...@gmail.com>wrote:

> Hi !
>
> I'm learning git and have a strange issue with a simple branch scenario:
>
> I created a new local branch "dev".
> So now I have two local branches: master and dev.On master, everything
> isup to date: nothing to add, nothing to commit.
>
> I've checked out the branch "dev" and made a change in one file. I haven't
> committed anything yet after this change.
> A git status tells me:
> # On branch dev
> # Changes not staged for commit:
> #   (use "git add <file>..." to update what will be committed)
> #   (use "git checkout -- <file>..." to discard changes in working
> directory)
> #
> # modified:   index.php
> #
> no changes added to commit (use "git add" and/or "git commit -a")
>
> Now I go back to "master" (git checkout master), and a "git status" tell
> me the following:
> # On branch master
> # Changes not staged for commit:
> #   (use "git add <file>..." to update what will be committed)
> #   (use "git checkout -- <file>..." to discard changes in working
> directory)
> #
> # modified:   index.php
> #
> no changes added to commit (use "git add" and/or "git commit -a")
>
> Why do I have a change to add on master whereas I made this change on my
> branch "dev" ?
>
> What do you think ?
>
> --
> 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.
>

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