Timeline for How do I undo 'git add' before commit?
Current License: CC BY-SA 4.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 15 at 15:03 | history | edited | Benjamin Loison | CC BY-SA 4.0 |
Remove unnecessary spaces
|
Aug 10, 2021 at 18:31 | comment | added | Vladimir Ch |
just what i searched git checkout -- <file> thanx !
|
|
Nov 27, 2020 at 14:10 | history | edited | sjas | CC BY-SA 4.0 |
edited body
|
Nov 3, 2019 at 13:30 | history | edited | Peter Mortensen | CC BY-SA 4.0 |
Active reading.
|
Oct 30, 2015 at 1:37 | history | edited | Mark Amery | CC BY-SA 3.0 |
formatting fix
|
Aug 10, 2014 at 19:54 | comment | added | DrewT |
The difference is git reset HEAD <file> is temporary - the command will be applied to the next commit only, but git rm --cached <file> will unstage untill it gets added again with git add <file> . Also, git rm --cached <file> means if you push that branch to the remote, anyone pulling the branch will get the file ACTUALLY deleted from their folder.
|
|
Apr 5, 2014 at 5:42 | history | edited | user456814 | CC BY-SA 3.0 |
Cleaned up formatting, now it's a little easier to read.
|
Nov 8, 2013 at 7:37 | history | edited | sjas | CC BY-SA 3.0 |
added 2 characters in body
|
Aug 15, 2013 at 15:09 | comment | added | sjas |
@jeswang files are either 'known' to git (changes in them are being tracked.), or they are not 'versioned'. reset head undoes your current changes, but the file is still being monitored by git. rm --cached takes the file out of versioning, so git no longer checks it for changes (and also removes eventually indexed present changes, told to git by the prior add ), but the changed file will be kept in your working copy, that is in you file folder on the HDD.
|
|
Aug 14, 2013 at 0:39 | comment | added | jeswang | I can't under stand the difference of 'git reset head <file>' and 'git rm --cached <file>. Could you explain it? | |
Jul 14, 2013 at 22:34 | history | edited | sjas | CC BY-SA 3.0 |
added 56 characters in body
|
Mar 29, 2013 at 11:20 | history | edited | sjas | CC BY-SA 3.0 |
edited body
|
Mar 29, 2013 at 11:14 | history | answered | sjas | CC BY-SA 3.0 |