岁月如梭,不知不觉间,我进入互联网行业已经两年有余。
两年的时间不算太长,但是技术也有了一定程度的积累。
我信奉的一条原则是:如果想要真正的掌握一门技术,就一定要亲自动手实践,并有所记录,否则就是在浪费时间。
于是,我有了写博客的习惯。
这是一个比较肤浅的问题,但对于 git 初学者来说,还是有必要提一下的。
用 git rm
来删除文件,同时还会将这个删除操作记录下来;
用 rm 来删除文件,仅仅是删除了物理文件,没有将其从 git 的记录中剔除。
git 暂存区的意义是什么?
1.git 的 add ,是一个容易引起疑问的命令。在 subversion 中的 svn add
动作是将某个文件加入版本控制,而 git add的意义完全不同。
同时, git diff --cached
是比较 stage 的文件的差异的,也是一个不直观的命令。
github 2008年的blog中,也提到,容易引起混淆:
https://github.com/blog/196-gittogether-2008
http://learn.github.com/p/normal.html
things like making use of the term ‘stage’ for things that happen in the index (such as using ‘git diff —staged’ instead of ‘git diff —cached’) is being worked on. I’m excited that staging files may soon be done via ‘git stage’ rather-than/in-addition-to ‘git add’. This is nice for new users who often have a hard time seeing why you have to keep ‘git add’ing to stage your changes.