GIT的理解和简单操作

轻量级的branch操作是git的一个根本特色。因为其他的版本管理工具是满足一般的需要的。但是对branch的操作,由于缺乏实践,暂时不深究。

GIT的操作一般是:
$ cd /home/user/my_project
$ git add *.c
$ git add LICENSE
$ git commit -m 'initial project version'
如果想要可视化的界面的支持的话,除了安装官方的git外,还可以选择性地安装tortoiseGit。
这样在Windows界面上就可以进行右键的可视化操作了。和操作SVN的感觉差不多。

其他:

-----------------

git commit -a

-a选项的解释:

Tell the command to automatically stage files that have been modified and
deleted, but new files you have not told Git about are not affected.
这一个选项似乎可以把add命令也顺便执行一下。
-----------------

The Three States
Pay attention now — here is the main thing to remember about Git if you want the
rest of your learning process to go smoothly. Git has three main states that your
files can reside in: committed, modified, and staged:

Committed means that the data is safely stored in your local database.
上句翻译:已经commit的表示已经安全存入到本地的数据库中了。
Modified means that you have changed the file but have not committed it to your
database yet.
上句翻译:修改的就是已经修改,但是没有进行任何git操作的。
Staged means that you have marked a modified file in its current version to go
into your next commit snapshot.
上句翻译:操作为标记为已缓存。
-----------------
git add .
add命令把当前的snapshot更新到staging中。为以后的commit做准备。

 参看资料:所有内容均可以在 https://git-scm.com/ 上查看到。并同时参考了其他人的cnblogs上的文章。

猜你喜欢

转载自www.cnblogs.com/praiseslow/p/10362490.html
今日推荐