Re: Any difference to unstage files using "git checkout" and "git rm"

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

 



On Monday, May 19, 2014 12:01:07 PM you wrote:
> On Mon, May 19, 2014 at 09:12:47PM +0630, Arup Rakshit wrote:
> > Is there any difference between the below 2 commands ? I didn't see
> > anything.
> > 

> 
> Does that help?

For me who is in Git just 6-7 days, It is huge. On your way, I was walking to 
test those out. But I got some messages from Git, which made me confused to 
think, about the *philosophy of those*.

arup@linux-wzza:~> mkdir Git_tutorial
arup@linux-wzza:~> cd Git_tutorial/
arup@linux-wzza:~/Git_tutorial> LS
If 'LS' is not a typo you can use command-not-found to lookup the package that 
contains it, like this:
    cnf LS
arup@linux-wzza:~/Git_tutorial> ls
arup@linux-wzza:~/Git_tutorial> echo "welcome to git" > test.txt
arup@linux-wzza:~/Git_tutorial> ls
test.txt
arup@linux-wzza:~/Git_tutorial> git init
Initialized empty Git repository in /home/arup/Git_tutorial/.git/
arup@linux-wzza:~/Git_tutorial> git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       test.txt
nothing added to commit but untracked files present (use "git add" to track)
arup@linux-wzza:~/Git_tutorial> git add test.txt
arup@linux-wzza:~/Git_tutorial> git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   test.txt
#

NOTE :- While, I have a new file in my repository, and I staged it, it is 
telling me to unstage it using *git rm -- cached <file>*. But once I committed, 
and the file became a tracked file in my repository, *Git* internal message got 
changed, *for unstaging*, Which is why, I asked this question. Look below -

arup@linux-wzza:~/Git_tutorial> git commit -m "commit1"
[master (root-commit) 20bf27f] commit1
 1 file changed, 1 insertion(+)
 create mode 100644 test.txt
arup@linux-wzza:~/Git_tutorial> echo "How are you enjoying?" > test.txt
arup@linux-wzza:~/Git_tutorial> git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   test.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
arup@linux-wzza:~/Git_tutorial> git add test.txt
arup@linux-wzza:~/Git_tutorial> git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   test.txt
#
arup@linux-wzza:~/Git_tutorial>

It is now telling to USE "git reset HEAD <file>..." to unstage, NOT   "git rm 
--cached <file>..." to unstage.

Please let me know, If I am making you guys more confused.

-- 
===============
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]