git 学习笔记2--How to create/clone a repository

1. create/clone

1.1 create

针对已经存在的目录创建一个repository,使用以下命令:

git init

Initialized empty Git repository in _path_/.git/

1.2 clone

从一个已知的repository克隆,使用以下命令:

git clone <url or ssh>

1.3 how to commit

创建或者克隆一个repository之后,就可以创建新的文件,然后使用以下命令提交:

git add <file> #将文件加入暂存Staging
git commit -m "commit messages" #将暂存中的文件提交到repository

2. status

未跟踪(untracked):表示当前的文件未被git跟踪,即没有被git管理。

暂存(index):表示当前的文件已经加入了repository,使用git add 命令后就是暂存状态。

提交(commit):把暂存状态的文件,使用git commit 命名后提交到对应的branch。一个Repository可以有N个branch。

repository:代表一个版本管理仓储,分为远程(remote)的和本地(local)的。一般我们的操作都是在本地,然后同步(push)到远程。

posted @ 2016-08-29 22:37  _DN  阅读(274)  评论(0编辑  收藏  举报