git 用于版本控制,记录的是对文本做了那些修改。
workspace: 工作区 即当前所处的分支
index/stage: 暂存区
repository: 本地仓库
remote:远程仓库
常用命令
git init project_name
git config --global user.name "liming"
git config --global user.email "lim@gmail.com"
git add train.py
git add .
git add [dir] # 添加指定目录到暂存区,包括子目录
git add -p
git rm train.py
git rm --cached train.py
git mv [file-orginal] [file-renamed]
git commit -m "add train.py"
git status
git remote add [代号] 远程地址.git
git push [代号] branch_name
git checkout master
git merge branch_name # 合并到本地master
git checkout branch_name
# git merge 之后回退到之前的某个版本
git reflog # 列出当前分支的所有版本号
git reset --hard [版本号] # 即head 编号
git push -f [代号] master # 将本地代码强行提交,覆盖远程git服务器代码
参考:
http://www.ruanyifeng.com/blog/2015/12/git-cheat-sheet.html
https://blog.csdn.net/marvel_cheng/article/details/89474792
网友评论