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

untracked file deleted from the master branch, when checked out to it from a local branch

From
Arup Rakshit <aruprakshit@rocketmail.com>
Date
May 20, 2014, 15:38 UTC
Message-ID
<2525467.KRXv8a3gWS@linux-wzza.site>

I was following some tutorial (http://gitref.org/branching/#merge) - and doing it in my console :

Arup-iMac:arup_git shreyas$ git status
# On branch master
nothing to commit, working directory clean
Arup-iMac:arup_git shreyas$ touch test.rb
Arup-iMac:arup_git shreyas$ ls
git_1.txttest.rb
Arup-iMac:arup_git shreyas$ cat test.rb
Arup-iMac:arup_git shreyas$ vi test.rb
Arup-iMac:arup_git shreyas$ cat test.rb
class Foo
  def self.bar
    12
  end
end
Foo.bar
***********HERE I switched to a NEW Branch****************
Arup-iMac:arup_git shreyas$ git checkout -b change_class
Switched to a new branch 'change_class'
Arup-iMac:arup_git shreyas$ ls
git_1.txttest.rb
Arup-iMac:arup_git shreyas$ vi test.rb
Arup-iMac:arup_git shreyas$ head -1 test.rb
class Fooo
Arup-iMac:arup_git shreyas$ head -2 test.rb
class Fooo
  def self.bar
Arup-iMac:arup_git shreyas$ git commit -am 'changed the class name'
# On branch change_class
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#test.rb
nothing added to commit but untracked files present (use "git add" to track)
Arup-iMac:arup_git shreyas$ git add test.rb
Arup-iMac:arup_git shreyas$ git commit -am 'changed the class name'
[change_class 2d40033] changed the class name
 1 file changed, 7 insertions(+)
 create mode 100644 test.rb
Arup-iMac:arup_git shreyas$ cat test.rb
class Fooo
  def self.bar
    12
  end
end

Fooo.bar Arup-iMac:arup_git shreyas$ git checkout master Switched to branch 'master' Arup-iMac:arup_git shreyas$ git mv test.rb ruby.rb fatal: bad source, source=test.rb, destination=ruby.rb Arup-iMac:arup_git shreyas$ git mv -h usage: git mv [options] <source>... <destination>

    -v, --verbose         be verbose
    -n, --dry-run         dry run
    -f, --force           force move/rename even if target exists
    -k                    skip move/rename errors
|--------------------------------------------------------------------------------------------------------------|
********FROM MASTER BRACH WHY THE FILE test.rb DELETED?***********
Arup-iMac:arup_git shreyas$ ls
git_1.txt
Arup-iMac:arup_git shreyas$ 
-- 
===============
Regards,
Arup Rakshit
Next: Marius Storm-Olsen
Message 1 of 10 in “untracked file deleted from the master branch, when checked out to it from a local branch”
  1. Arup RakshitMay 20, 2014
  2. Marius Storm-OlsenMay 20, 2014
  3. Arup RakshitMay 20, 2014
  4. Marius Storm-OlsenMay 20, 2014
  5. Arup RakshitMay 20, 2014
  6. Junio C HamanoMay 20, 2014
  7. Arup RakshitMay 20, 2014
  8. Marius Storm-OlsenMay 20, 2014
  9. Sergei OrganovMay 21, 2014
  10. Marius Storm-OlsenMay 20, 2014

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.