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

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

From
Arup Rakshit <aruprakshit@rocketmail.com>
Date
May 19, 2014, 16:11 UTC
Message-ID
<2609761.VA4bvU75e5@linux-wzza.site>
In-Reply-To
<20140519160107.GE20289@sigill.intra.peff.net>
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
Previous: Jeff King
Message 5 of 5 in “Any difference to unstage files using "git checkout" and "git rm"”
  1. Arup RakshitMay 19, 2014
  2. Arup RakshitMay 19, 2014
  3. Jeff KingMay 19, 2014
  4. Jeff KingMay 19, 2014
  5. Arup RakshitMay 19, 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.