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
- 本文链接:http://yexun1995.github.io/2023/01/01/GIT/
- 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!