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
endFoo.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
endFooo.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