git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: file in new branch also shown in master branch?

From
David Aguilar <davvid@gmail.com>
Date
Dec 28, 2009, 23:25 UTC
Message-ID
<20091228232539.GA16146@gmail.com>
In-Reply-To
<92c9564e0912281437g20fe51f9ta33383791ef20385@mail.gmail.com>
On Mon, Dec 28, 2009 at 04:37:08PM -0600, Carlos Santana wrote:
Show 6 quoted lines
> Hi,
> 
> I tried following commands to test branching:
> 
> git branch test
> git checkout test
1. You are now on branch "test"
> echo "Test branch" >> testfile
> git status
2. This does nothing as far as git is concerned.
   "testfile" is still unknown to git.
> git checkout master
3. You are now on branch "master"
> git add .
> git commit
4. You just committed "testfile" to branch "master".
   Recall #3.  This may be where your confusion began.
> The 'testfile' file shows up in 'master' as well as 'test'. I thought
Nope, it only shows up in master.
try:
    git checkout test
It is gone.
> or am I missing something? I was unable to repeat same behavior again,
> so I am confused now. Any clues?
These are great references:

http://book.git-scm.com/3_basic_branching_and_merging.html http://progit.org/book/ch3-0.html

Have fun,
-- 
		David
Previous: Carlos Santana
Message 2 of 2 in “file in new branch also shown in master branch?”
  1. Carlos SantanaDec 28, 2009
  2. David AguilarDec 28, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.