Linux安装Git
sudo apt-get install git
创建版本库
$ mkdir mygit
$ cd mygit
$ pwd //查看版本库位置
$ git init //把这个目录变成可管理的仓库
添加文件到仓库
git add myfile.txt //添加一个文件
or
git add myfiles/ //添加文件夹
git commit -m '提交的说明' 将文件提交到仓库
查看工作区状态
git status
git diff //查看修改内容
版本穿梭
git log //查看提交历史,确定回到修改前的某个版本
git reset --hard commit_id
git reflog //查看命令历史,确定回到修改后的某个版本
远程仓库
1 创建ssh
$ ssh-keygen -t rsa -C "youremail@example.com"
2 登陆GitHub,打开“Account settings”,“SSH Keys”页面:
然后,点“Add SSH Key”,填上任意Title,在Key文本框里粘贴id_rsa.pub文件的内