git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David J. Neu" <davidjneu@gmail.com>
To: git@vger.kernel.org
Subject: git-checkout question
Date: Sun, 13 Jan 2008 09:21:40 -0500	[thread overview]
Message-ID: <20080113142140.GB10426@bach.davidneu.local> (raw)

Hi, 

I was wondering if someone could explain the following behavior.

1. create and switch to branch off master
2. edit a file in the branch
3. checkout master without committing changes in the branch
4. the changes in the branch are automatically applied in working tree 
   in master

I wasn't expecting the changes in the branch to be automatically
moved to master.  Had I committed while in the branch this doesn't
happen.  I'm using git version 1.5.3, the details are below.

Many thanks!

Cheers,
David

[/tmp] mkdir git-test
[/tmp] cd git-test
[/tmp/git-test] git-init 
Initialized empty Git repository in .git/
[/tmp/git-test] # create hello.py
[/tmp/git-test] git-add hello.py 
[/tmp/git-test] git-commit   
Created initial commit 58282ee: Initial commit of git-test.
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 hello.py
[/tmp/git-test] cat hello.py 
print "hello from master."
[/tmp/git-test] git-checkout -b test-branch
Switched to a new branch "test-branch"
[/tmp/git-test] # modify hello.py
[/tmp/git-test] cat hello.py 
print "hello from test-branch."
[/tmp/git-test] git-checkout master
M       hello.py
Switched to branch "master"
[/tmp/git-test] cat hello.py 
print "hello from test-branch."
[/tmp/git-test] # hmmm?

             reply	other threads:[~2008-01-13 14:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-13 14:21 David J. Neu [this message]
2008-01-13 14:31 ` git-checkout question Steffen Prohaska
2008-01-13 15:12   ` David J. Neu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080113142140.GB10426@bach.davidneu.local \
    --to=davidjneu@gmail.com \
    --cc=djneu@acm.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).