- 创建版本库
cd $dir git init # 创建文件 vim 123.txt # 提交文件(每次提交修改的文件,都要add,再commit) git add 123.txt git commit -m "第一次提交" #查看提交日志 git log --pretty=oneline #撤销修改,还原为最近一次commit或add的文件 git checkout -- file #把本地库的文件变化推送到远端仓库 git push origin master
cd $dir
git init
# 创建文件
vim 123.txt
# 提交文件(每次提交修改的文件,都要add,再commit)
git add 123.txt
git commit -m "第一次提交"
#查看提交日志
git log --pretty=oneline
#撤销修改,还原为最近一次commit或add的文件
git checkout -- file
#把本地库的文件变化推送到远端仓库
git push origin master