git常用总结

git 基本配置

安装git
yum -y install git

git全局配置
git config --global user.name "lsc"                #配置git使用用户
git config --global user.email "[email protected]"  #配置git使用邮箱
git config --global color.ui true                  #语法高亮
git config --list                                  # 查看全局配置

Git常用操作

git 提交代码

# 提交文件到暂存区
git add .   #添加所有更改到文件
git add test.py  # 添加指定文件 

# 查看状态
git status

#提交到本地代码库
git commit -m "提交说明"

# push到远程代码库
git push -u origin master 

# 更新代码,必须在git项目目录中
git pull

git clone指定的tag

git clone --depth=1 --branch=指定tag git@地址
--depth    depth用于指定克隆深度,为1即表示只克隆最近一次commit.
--branch   拉取指定tag

猜你喜欢

转载自www.cnblogs.com/root0/p/10994083.html