git基本使用
2018-01-16 09:44
330 查看
Git基本使用
问题:git是什么?有什么用?怎么用?
解答
解析
git是分布式版本控制系统应用
用于代码管理,多人团队协助使用
0.安装#centos默认已安装 yum -y install git
1.安装后初始配置
#配置全局 git config --global user.name "Your Name" git config --global user.email "email@example.com" #查看 git config --local --list # 配置当前git库用户 git config user.name/email
2.新建代码库
git init
把工作区的取消
git checkout -- file
查看工作区代码的修改
git diff
撤销暂存区的操作
git reset HEAD file
回滚到最新的当前分支
git reset --hard
tag回退
#先列出tag清单 git tag -l #再回退到某个tag git checkout <tag_name>
查看文件作者
git blame <file_name>
问题
1.git pull时需要输入账号密码解决:
git config --global credential.helper store
例子
[root@compile Test]# git pull Username for 'https://gitlab03.test.com': test Password for 'https://l0995@gitlab03.test.com': Already up-to-date. [root@compile Test]# git config --global credential.helper store [root@compile Test]# git pull Already up-to-date. [root@compile Test]# git pull Already up-to-date.
参考
1.Git教程 - 廖雪峰的官方网站相关文章推荐
- 【git 的基本使用】
- 关于git的一些基本使用命令
- Git基本使用方法——分支
- 【Git 使用笔记】第二部分:基本命令 和 单分支开发
- GIT的基本使用
- git学习篇1——git的安装和基本使用
- Git 使用基本操作
- git 基本使用
- GIT - 基本使用命令
- git 基本配置及使用
- Git环境搭建与基本使用方法 (转自http://blog.csdn.net/fireelement/article/details/9618363)
- sourceTree和git和git hub之间的关系以及基本使用(不包含命令行)
- Linux系统下Git的基本配置和使用示例
- Git的基本使用
- git基本使用
- Git入门——分支的基本使用与'合并'、'多人协作'常遇到的问题
- Eclipse使用Git基本流程
- git config命令使用第一篇——介绍,基本操作,增删改查
- 一些关于git的基本使用方法