Skip to content

Instantly share code, notes, and snippets.

@sxfmol
Last active September 28, 2022 04:31
Show Gist options
  • Save sxfmol/216025b14348724df0b54631a8116d89 to your computer and use it in GitHub Desktop.
Save sxfmol/216025b14348724df0b54631a8116d89 to your computer and use it in GitHub Desktop.
你需要的命令只有 branch、checkout 和 commit。
git 备忘清单
https://training.github.com/downloads/zh_CN/github-git-cheat-sheet/
图表强大、详细介绍
https://git-scm.com/book/zh/v2/Git-%E5%88%86%E6%94%AF-%E5%88%86%E6%94%AF%E7%AE%80%E4%BB%8B
https://training.github.com/downloads/zh_CN/github-git-cheat-sheet/
三种状态
现在请注意,如果你希望后面的学习更顺利,请记住下面这些关于 Git 的概念。 Git 有三种状态,你的文件可能处于其中之一: 已提交(committed)、已修改(modified) 和 已暂存(staged)。
你可以通过以下命令查看所有的配置以及它们所在的文件:
$ git config --list --show-origin
如果想要检查你的配置,可以使用 git config --list 命令来列出所有 Git 当时能找到的配置。
$ git config --list
第一步现在github创建项目如tmp
echo "# tmp" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/sxfmol/tmp.gitgit push -u origin main
#创建分支
git branch test
切换分支
git switch text
#当前分支检查
git checkout
git fetch
#合并
git pull origin main(分支)
#提交系统更新
git add
git commit -m 'ww'
git push origin text
1: A机器创建git目录,初始化、增加文件、提交到服务器
2: A机器从服务器获取新的文件,查看服务器与本地文件的差异,
确定合并策略(服务器为准,本地为准-本地提及到服务器并进行服务器上的覆盖,在服务器新建一个分支然后继续提交;
3:A机器创建多个分支,分别提交
4:A机器上的本地分支删除,并提交到服务器也进行删除
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment