Git 命令速查表
你好,Dev,
我们都知道Git,但我想分享一些关于它的内容,在我日常使用中,它是所有开发人员都需要的基本备忘单。
我们团队合作完成项目时,经常发生代码冲突。当时我们决定在办公室桌子上方的墙上贴一张小抄。
Git克隆:
git clone https://name-of-the-repository-link
Git 新建分支、列出、删除:
git branch -b (branch name)
git branch or git branch --list
git branch -d
Git 结帐:
git checkout (branch name)
Git Switch:
git switch 表示您已经创建了分支。
git switch (branch name)
Git 状态命令:
如当前分支、提交、推送或拉取、文件暂存、未暂存或未跟踪、文件创建、修改或删除
git status
Git 添加:
git add
git add -A (for everything)
Git 提交:
git commit -m "commit message"
Git Push:用于上传本地 repo 内容
- git push:通常用于将本地仓库内容上传到远程仓库。
- git push --set-upstream:设置分支“branch Name”以从“origin”跟踪远程分支“branch Name”。
- git push -u origin:用于推送现有工作分支。
git push
git push --set-upstream
git push -u origin
Git Pull:用于从本地仓库获取合并分支
git pull
Git Merge:将分支合并到另一个
git checkout (branch name)
git fetch
git merge
感谢您的阅读。
文章来源:https://dev.to/anitaparmar26/git-command-cheat-sheet-31ec