git 简明教程(2) --获取工程与更新

本文介绍如何通过Fork项目到个人GitHub账号中,并将其克隆到本地进行编辑提交的过程。包括获取项目、本地编辑及同步远程仓库等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

当要参与github上面的t项目时,首先需要 fork 工程到自己的github帐号中,然后 clone到本地,进行编辑并提交


1.获取工程到自己的github中

在 目标项目 中点击 fork ,自己的github帐号中

2.clone -获取工程到本地

git clone https://github.com/username/Spoon-Knife.git
# Clones your fork of the repository into the current directory in terminal

3.编辑并上传 参考上篇

git add .

git commit -am 'add files'

git push origin master


4.获取原工程(不是自己github中的工程)的实时更新

git remote add upstream https://github.com/octocat/Spoon-Knife.git
# Assigns the original repository to a remote called "upstream"

git fetch upstream
# Fetches any new changes from the original repository
git merge upstream/master
# Merges any changes fetched into your working files

此时 工程中的任何更新都会合并入本地工程中。


至此,完成 对 目标工程的跟踪以及对目标文件的提交。


参考 fork a repository



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值