Git基本操作

时间:2015-01-30 15:27:56   收藏:0   阅读:166

基本操作练习 https://try.github.io

git init 初始化仓库

git status 查看状态

git add ‘*.txt‘ 将文件加入管理

git commit -m "说明" 提交变动

git log 查看提交的历史记录

git remote add origin https://github.com/try-git/try_git.git 指定远程的仓库

git push -u origin master 将本地master分支推送到在线仓库,-u表示记住参数,下次可直接使用git push

git pull origin master 从在线仓库读取最新版本到master分支

git diff HEAD 查看最新版本的变动

git diff --staged 查看本地文件与最新版本的差异

git reset xxx.txt add的反操作

git checkout -- <target> 文件回退到最新版本

git branch branch_name 创建新分支branch_name

git checkout branch_name 切换到分支branch_name

git rm ‘*.txt‘ 删除文件

git merge branch_name 将分支branch_name合并到主分支

git branch -d branch_name 删除分支

?

进阶阅读http://git-scm.com/book

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!