i've read that the mv command is basically the same as
$ mv README.txt README
$ git rm README.txt
$ git add README
just to be sure, is it exactly the same if i do it this way:
$ git rm --cached README.txt
# [rename file using right click rename]
$ git add README
No. the --cached param is recommended when what you want is unstage and remove paths (in this case, the README.txt) only from the index. Working tree files, whether modified or not, will be left alone.
A better approach, on this case that is renaming a file, is use the build-in mv command of git. So:
$ git mv README.txt README
would have the same effect as you first approach, but with less type.
Font: http://www.kernel.org/pub/software/scm/git/docs/git-rm.html
See What's the purpose of git-mv?.
Yes, it's pretty much the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With