git init
git clone url
git add 新增到暂存区,但是未提交
git rm
git commit 提交(本地版本库的改动,不影响远端)git commit file-name -m “提交信息”
git commit file-name -am "提交信息"批量提交
git mv 移动/重命名
git diff版本差异
git status工作区与暂存区状态,看新增文件是否被暂存纳入版本库
git log 历史提交日志
git push本地推送到远端仓库
git push origin branch_name(Windows大小写不敏感)
git branch 查看本地所有git分支名称
git branch -r查看远端服务器有哪些分支
git branch 和 git checkout -b 都是新建分支
git branch new-name不会切换到新分支
git checkout -b new-name新建之后会自动切换过去
git branch -d删除本地分支
git branch -r branch-name删除远程分支
删除后必须要推送到服务器上git push origin:branch_name
git checkout -f强制切换分支
git pull origin remote-branch:local_branch获取远端某个分支的更新,再与本地指定分支合并git pull origin remote-branch(远端与本地指定分支相同)
git fetch origin remote-branch:local_branch获取远端某个分支的更新,但是不合并
git merge branch-name指定分支合并到当前分支git rebase 类似
git reset commit_id工作区还原
git checkout . 用于回退本地所有修改而为提交的文件内容(用暂存区的覆盖本地修改的)