On Fri, Jan 7, 2011 at 6:58 PM, Curtis Olson wrote:

> I make a small test edit to a file (src/GUI/MapWidget.cxx).
> I run "git checkout next" to return to the pristine unchanged branch that
> tracks the head on gitorious --- but here is the output:
> $ git checkout next
> M src/GUI/MapWidget.cxx
> Switched to branch 'next'
> $ git branch
>   maint
>   mychanges
> * next
> "next" is the current branch, but the change I made in the mychanges branch
> to MapWidget.cxx is still visible.

> What am I missing?  Why is a change that I made in one branch being shown in
> a different branch?
The change you made is _not_ in any branch yet. It's just a local
change in your filesystem. git doesn't automatically add any changes
to a branch. Maybe you just edited the file for a temporary test. Or
you find out the change doesn't work at all and want to revert it
immediately. You need to explicitly add any change to a branch -
otherwise the change isn't in git.
So, only when you run "git add MapWidget.cxx; git commit" is your
modified file added to the current branch.
Running "git checkout somebranch" won't touch modified files in your
filesystem. I actually really like this feature: you can make local
changes and then quickly change branches to see how the changes work
with different branches. When you're happy, you switch to the branch
you want to commit it to and finally add and commit the change to git.

cheers,
Thorsten

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to