git init //初始化 git add . //加入暂存区 git status //查看暂存区 git commit -m "描述" //提交到本地仓库 git remote add origin 仓库地址 //建立本地仓库和远程仓库的链接 git pull //从远程仓库拉取代码 git merge 需要合并的分支名 合并分支 git push -u origin 分支名 //将代码上传到远程仓库(推到特定的分支才需要写) git push //将代码推送到远程仓库
git branch //查看分支 git branch -d 分支名 //删除本地分支 git chenkout 分支名 //跳转分支 git checkout -b 分支名 //创建分支并跳转到改分支 git log //查看日志 git log --oneline //查看提交日志简略版 git clone 远程仓库的地址 //克隆远程仓库的代码 git remote -v //查看当前远程仓库地址 git reset //回退(在commit之前可以通过git reset 将文件恢复到commit之前)