GIT基本操作(测试人员)

默认已安装GIT,在当前目录右键-- git bash here--进入bash模式
初次下载代码(例子为http方式)

$ git clone http://xxx.xxx.xxx.xxx/xxx/xxxxx.git

查看当前分支(带星号的为当前分支,默认应为develop)

$ git branch

查看远程分支

$ git branch -a

切换分支到20171204

$ git checkout feature/20171204

下载代码(从远程获取最新版本并merge到本地
$ git pull  //简化版 
$ git pull origin feature/20171204   
//远程主机origin的feature/20171204分支,获取并合并到当前的本地分支 
打标签

$ git tag -a v1.0.0.alpha -m "1218二轮提测"

列出标签

$ git tag

提交标签到远程仓库
$  git push origin -tags  //提交所有tag到远程仓库
$  git push origin v1.0.0.alpha  //提交指定tag到远程仓库
清理
$ git clean -n   //-n显示 将要 删除的 文件 和  目录
$ git clean -df   //-f 删除 文件,-df 删除 文件 和 目录
列出远程主机

$ git remote

列出远程主机网址

$ git remote -v

配置列出

$ git config --list

查看提交历史

$ git log //不加参数列出所有,时间倒序

$ git log -p -2 //-p 选项展开显示每次提交的内容差异,用 -2 则仅显示最近的两次更新

$ git log --oneline //简洁模式



$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

如果用了 --global 选项,那么更改的配置文件就是位于你用户主目录下的那个,以后你所有的项目都会默认使用这里配置的用户信息。如果要在某个特定的项目中使用其他名字或者电邮,只要去掉 --global 选项重新配置即可,新的设定保存在当前项目的 .git/config 文件里。

你可能感兴趣的:(GIT基本操作(测试人员))