git基本使用

git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/bradleydan/miniprogram.git
git push -u origin master

 打标签

git tag 01_知识点1

git tag 查看tag

git push --tag

 

 

基本命令

git config --global user.name "bradleydan"

git config --global user.email "894145261@qq.com"

 

ssh-keygen -t rsa -C "894145261@qq.com"

 

ssh -T git@github.com

 

git init

 

git add .

 

git commit -m "ss"

 

git config --list

 

git remote rm origin

 

git remote add origin https://github.com/bradleydan/Test.git

 

git push -u origin master

本地创建git信息

git  --help 获取帮助

创建仓库

git init

初始化项目

提交项目到版本控制

git commit -m "初始化项目"

配置邮箱和用户名( 全局和局部的)

全局默认一个git仓库没有配置用户名和邮箱就使用全局的

局部的仅针对本项目才有效

git config "user.name" zhangsan

git config "user.email" zhangsan@jsj.com.cn

stage暂缓区  master 主干

提交的时候要把新文件添加到暂缓区,然后再提交到master

git add .

git status 绿色就可以提交

git commit -m "初始化项目"

修改文件提交 

git add .

git commit -m "修改"

版本回退

git reset --hard HEAD^ 上一版本

git reflog 查看分支的所有操作记录

git reset --hard 版本号 恢复到指定版本

git reset --hard HEAD^^ 恢复到版本

git reset --hard head~3 回退三个版本

删除文件

touch person.h

git rm person.h

日志格式

git log --pretty=oneline

修改日志样式 git lg
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

配置别名

git config alias.cfg config

git cfg "user.name" zhangsan

git cfg alias.ct "commit -m"

查看分支

git branch

查看指定分支没有就创建

git branch v1

切换分支

git checkout v1

合并分支

git merge v1

删除分支

git branch -d v1

 

git tag --01

git push --tags

图形化界面

source control中查看历史版本和提交当前版本

创建账户信息提交代码

在开源中国中注册,并创建项目

https://git.oschina.net/bradleydan/WeChat.git

通过终端从远程服务器上拷贝代码

git clone https://git.oschina.net/bradleydan/WeChat.git

创建账户信息

 git config --global user.email "message@hotmail.com"

 git config --global user.name "message"

添加项目代码提交到本地  必须包含.git文件

git commit -m "初始化代码"

查看日志

git log

上传到服务器

git  push

更新

git pull

多人开发

添加一个项目组

往项目组里面添加项目

现在后台添加一个开发者,把开发者添加到开发者组

把开发者组添加到项目组

 

posted @ 2015-09-15 21:18  bradleydan  阅读(95)  评论(0)    收藏  举报