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 Tuesday, May 20, 2014 11:24:11 AM you wrote:
> Arup Rakshit <aruprakshit@xxxxxxxxxxxxxx> writes:
> 
> Untracked files and modifications to files in your working directory
> do not belong to your current branch.  This is to allow you, after
> starting to work on one branch then realizing that the changes and
> additions you are making do not belong there, to switch to a more
> appropriate branch at that point without losing your work so far,
> taking these changes and additions with you to the branch you want
> to commit your changes to.
> 
Now, It makes sense. I gave it another try and this time I walk from back to 
front.

Now you can see, that I have created, a new file called *file.txt*, in the 
*master branch*. Now I went to a new branch and made some changes there in the 
newly created file. This time I didn't add it or commit too. I just came back 
to *master branch*. Now if I do *ls*,  can see the file is present in the 
*master* branch.

arup@linux-wzza:~/Git_tutorial> ls
test.txt
arup@linux-wzza:~/Git_tutorial> echo "hello" > file.txt
arup@linux-wzza:~/Git_tutorial> ls
file.txt  test.txt
arup@linux-wzza:~/Git_tutorial> git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       file.txt
nothing added to commit but untracked files present (use "git add" to track)
arup@linux-wzza:~/Git_tutorial> cat file.txt
hello
arup@linux-wzza:~/Git_tutorial> git checkout -b "file_branch"
Switched to a new branch 'file_branch'
arup@linux-wzza:~/Git_tutorial> cat file.txt
hello
arup@linux-wzza:~/Git_tutorial> echo "hello World" > file.txt
arup@linux-wzza:~/Git_tutorial> cat file.txt
hello World
arup@linux-wzza:~/Git_tutorial> git status
# On branch file_branch
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       file.txt
nothing added to commit but untracked files present (use "git add" to track)
arup@linux-wzza:~/Git_tutorial> git checkout master
Switched to branch 'master'
arup@linux-wzza:~/Git_tutorial> ls
file.txt  test.txt
arup@linux-wzza:~/Git_tutorial> cat file.txt
hello World
arup@linux-wzza:~/Git_tutorial>


-- 
===============
Regards,
Arup Rakshit
--
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]