Open zhuangjinxin opened 3 years ago
git add .添加变更到暂存区 git commit -m''提交变更到当前分支 git push origin <branch>推送变更到远程仓库
git add .
git commit -m''
git push origin <branch>
git status查看变更状态 git diff查看变更内容 git log 查看提交记录 git log --graph --pretty=oneline --abbrev-commit 查看分支合并图 git reflog 查看历史命令
git status
git diff
git log
git log --graph --pretty=oneline --abbrev-commit
git reflog
git reset --hard head^ (head~n) 往前回退 git reset --hard <commit_id> 指定版本 git reset HEAD <file> 指定版本
git reset --hard head^ (head~n)
git reset --hard <commit_id>
git reset HEAD <file>
git checkout -- <file> 撤销修改文件 git checkout -b'BRANCH' origin/master 新建分支 git checkout <branch> 切换分支
git checkout -- <file>
git checkout -b'BRANCH' origin/master
git checkout <branch>
远程仓库: git remote add origin <ssh_url> 添加远程仓库 git push -u origin master 第一次推送,关联本地master与远程master git push origin master 推送本地内容到远程 git clone <ssh_url> 克隆远程仓库
git remote add origin <ssh_url>
git push -u origin master
git push origin master
git clone <ssh_url>
分支管理: git branch 查看分支 git branch <branch> 新建分支 git branch -d <branch> 删除分支 git branch -D <branch> 强制删除分支 git checkout <branch> 切换分支 git checkout -b'<branch>' 新建并切换分支 git merge <branch> 合并某分支到当前分支 git switch -c <branch> 新建并切换分支 git switch <branch> 切换分支
git branch
git branch <branch>
git branch -d <branch>
git branch -D <branch>
git checkout -b'<branch>'
git merge <branch>
git switch -c <branch>
git switch <branch>
git add .
添加变更到暂存区git commit -m''
提交变更到当前分支git push origin <branch>
推送变更到远程仓库git status
查看变更状态git diff
查看变更内容git log
查看提交记录git log --graph --pretty=oneline --abbrev-commit
查看分支合并图git reflog
查看历史命令git reset --hard head^ (head~n)
往前回退git reset --hard <commit_id>
指定版本git reset HEAD <file>
指定版本git checkout -- <file>
撤销修改文件git checkout -b'BRANCH' origin/master
新建分支git checkout <branch>
切换分支远程仓库:
git remote add origin <ssh_url>
添加远程仓库git push -u origin master
第一次推送,关联本地master与远程mastergit push origin master
推送本地内容到远程git clone <ssh_url>
克隆远程仓库分支管理:
git branch
查看分支git branch <branch>
新建分支git branch -d <branch>
删除分支git branch -D <branch>
强制删除分支git checkout <branch>
切换分支git checkout -b'<branch>'
新建并切换分支git merge <branch>
合并某分支到当前分支git switch -c <branch>
新建并切换分支git switch <branch>
切换分支