git常用命令

git可用于代码版本的管理,与CVS,SVN一起是最为流行的代码版本管理工具,在这里记录下最为常用的一些命令,以备后续查看:

帮助命令
git --help
git help reomote/push

初始化一个本地仓库
git init

配置本地用户名邮箱,用于登录远程仓库时的身份
git config --global user.name "John Doe"
git config --global user.email [email protected]


查看本地关联的所有远程仓库
git remote -v

添加远程仓库
gir remote add [short-name] [url]
git remote add origin [email protected]:yyfrankyy/search.git

直接clone一个远程仓库到本地
git clone [email protected]:projects/search.git

从远程仓库获取更新
git fetch/pull

提交更新到本地仓库
git commit -m 'description'

提交更新到远程仓库
git push origin mater
-------------------------------------------------------------------
分支命令

创建一个新的分支
git branch newBranchName

切换的另一个分支
git checkout otherBranch

新建并切换到新分支
git checkout -b newBranchName

详细命令可参考 《Pro git》

你可能感兴趣的:(git)