linuxmit下git安装和初级使用

一.安装

sudo apt-get install git

二.配置

git config --global user.name "Your Name"
git config --global user.email "email@example.com"

三.常用命令

git init  #创建版本库
git add YourFileName  #添加文件到版本库
git commit -m"description to your commit"  #提交文件到版本库
git status #版本库状态
git diff #查看修改

git log #查看日志,返回commit id
git reset --hard HEAD^ #回退到上一个版本
git reset --hard <commit id>
git reflog #查看记录的每一次命令

四.远程仓库

1.注册github账号
2.创建SSH Key

ssh-keygen -t rsa -C "youremail@example.com"

3.找到.ssh目录,复制id_rsa.pub中的内容。
4.打开github网站,点击SSH Key,在弹出的方框中粘贴复制的内容

原文地址:https://www.cnblogs.com/liaozhichao/p/4928603.html