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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/20/2014 10:38 AM, Arup Rakshit wrote:
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****************
...
********FROM MASTER BRACH WHY THE FILE test.rb DELETED?***********
Arup-iMac:arup_git shreyas$ ls
git_1.txt

Because you never committed the original file to the master branch before you created and switched to the change_class branch.

You're missing
    git add test.rb
    git commit -m "initial version of test.rb"
before you switch branches the first time.

--
.marius

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]