git (ubuntu:14.04)
1. 提交命令
- 创建版本库
git init
- 创建文件
echo "# gittest" >> README.md
- 文件添加到仓库
git add README.md
- 文件提交到仓库
git commit -m "wrote a readme file"
- 关联远程仓库
git remote add origin git@server-name:path/repo-name.git
- 第一次提交
git push -u origin master
- 第二次提交
git push origin master
小结
第一次提交
# apt install git
# git config --global user.name "Your Name"
# git config --global user.email "email@example.com"
# ssh 配置
git init
git add file
git commit -m " file information"
git remote add origin git@server-name:path/repo-name.git
git push origin master
之后提交
git add file
git commit -m " file information"
git push -u origin master
2. 克隆仓库 git clone git@server-name:path/repo-name.git
3.仓库命令
- 仓库状态
git status
- 修改内容
git diff readme.txt
- 查看提交历史
git log
- 版本跳跃
git reset --hard commit_id