git学习
git代码托管机制
- git add . —添加到代码缓存区域
- git commit – 提交到代码仓库
git 的常用命令
设置用户签名
git --version
// 查看git 版本号
git config --global user.name OneByOne
// 设置用户信息
git config --global user.email ****@163.com
// 设置用户邮箱
可以本地地用户目录下面看到以
.gitconfig
的文件查看是否设置(修改)成功
初始化本地仓库
// 初始化本地库
git init
// Initialized empty Git repository in D:/vueLearning/day07Vuex/.git/
.git
为隐藏文件,但是其实它也不需要进行修改
查看本地库状态
git status
// On branch master 默认分支为master
// No commits yet 还未提交任何内容
// nothing to commit (create/copy files and use "git add" to track) 缓存区域无提交任务
新建一个文件(模拟提交作用)
vim hello.txt
// 创建一个hello.txt文件
// 内容如下
/**
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
hello git!
*
/
相较于之前
git status
的变化
添加到暂存区
git add hello.txt
// 提交到暂存区域
// warning: in the working copy of 'hello.txt', LF will be replaced by CRLF the next time Git touches it
// 无需管理 此warning 警告 其为linux 与 windows 的换行符转化问题
相较于之前
git status
的变化
删除暂存区的文件(有的时候上传错误会用到)
git rm --cached hello.txt