Table of Contents
初始化仓库
git init
克隆仓库
git clone 地址
远程拉取
git -c core.quotepath=false -c log.showSignature=false pull --progress --no-stat --no-commit -v --progress origin master
git pull 分支地址
添加文件
git add 你的文件
git -c core.quotepath=false -c log.showSignature=false add --ignore-errors -- 你的文件
提交本地分支
git commit -m "first commit"
指定提交文件
git -c core.quotepath=false -c log.showSignature=false commit -m "first commit" --only -F C:\Users\MCL\AppData\Local\Temp\git-commit-msg-.txt -- 你自己的文件
推送到远程分支
git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master --set-upstream --follow-tags
git push --set-upstream 分支地址 master
合并分支
git merge 分支名称 --no-commit
查看当前分支
git checkout
查看所有分支
git branch -a
查看修改
git diff
版本回滚
git reset --hard
撤销远程
git revert 分支名称
撤销本地提交
git reset --soft HEAD~1
git reset --soft HEAD~2
--mixed :不删除工作空间改动代码,撤销commit,撤销git add
--soft :不删除工作空间改动代码,撤销commit,不撤销git add
--hard :删除工作空间改动代码,撤销commit,撤销git add
合并多次提交
: 合并前两次提交
git rebase -i HEAD~2
: 修改第二个递交节点为s。s表示合并覆盖
pick id "注释"
s id "注释"
: wq 保存