> From: djsuperfive <maximefresch...@gmail.com>
> Why do I have a change to add on master whereas I made this change on my
> branch "dev" ?
I think I can explain this more clearly:
You changed a file, but since you didn't add or commit it, none of the
branches is affected. git-status is just telling you that the file
index.php that is in the working directory isn't the same as the one
in the index (and the one in the index is the same as the head of the
Now you tell Git to switch to a new branch. Git adjusts the internal
data structures, of course, but it also has to adjust all the files in
the working directory to match the new branch head. What is it to do
with the changed file in the working directory? In general, it leaves
it alone, so you don't lose your changes. In specific, if the
version of that file is different in the two branches, Git tries to
merge the inter-branch changes with the changes you've inserted; it
can get messy.
As far as I can tell, Git does a similar update process on the index,
whose contents may not have been the same as the old branch's head.
This leads to a situation you might not expect:
Suppose you have branch master checked out. Now change index.php to
be the same as the version in the head of branch dev. git-status will
show it as being modified.
Now check out branch dev. If I have it right, Git will merge the
change it sees in the working copy of index.php with the inter-branch
change (both of which are the same) to leave a copy of index.php which
matches the head of branch dev. git-status will now show index.php as
not being modified.
Now check out branch master. index.php isn't modified any more!
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
For more options, visit https://groups.google.com/groups/opt_out.