Git 配置流程及常用命令 For Ubuntu
Git身份设置
1 | git config --global user.name "John Smith" |
项目生成
1.项目Clone
1 | git clone 项目地址 |
可以用 -b 指定master分支
2.添加原始项目地址
1 | git remote add upstream 项目地址 |
3.fetch原始项目:
1 | git fetch upstream |
4.切换到本地master分支:
1 | git checkout master |
5.将upstream/master merge到 本地master分支:
1 | git merge upstream/master |
6.push到自己的github仓库:
1 | git push origin master |
同步上游仓库 另一种方案
1 | git remote update upstream |
此方案相对更简洁,很多人都推荐这么做。
git强制覆盖:
1 | git fetch --all |
git强制覆盖本地命令(单条):
1 | git fetch --all && git reset --hard origin/master && git pull |
- 标题: Git 配置流程及常用命令 For Ubuntu
- 作者: Filo
- 创建于 : 2023-01-01 14:59:30
- 更新于 : 2023-01-01 15:03:41
- 链接: http://yexun1995.github.io/2023/01/01/GIT/
- 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。