【git使用】fork后拷贝至本地;建远程仓库

克隆远方仓库的项目到本地git clone url.git
注意,一定要有.git,不是只有一个url就可以了

查看本地分支git branch
这时候一般只有master分支

查看远方仓库分支git branch -a
如果远方仓有好几个分支,举例如下:第一行表示自己这个项目是fork别人的,指向的是原作者的master。第二行表示自己远方主分支master。第三行表示远方分支exercise。

remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/exercise

克隆远方分支到本地git checkout -b exercise origin/exercise
建立本地分支exercise并从master切换到它,将远方分支exercise拷贝到本地分支exercise。

修改文件,这里用modified_file指代。

如果想删除远方仓库文件

git rm --cached file
git commit -m "your note"
git push origin branch

提交文件

git add modified_file
git commit -m "your notice for this modification"

传回远方分支git push origin exercise

以上是完整的拷贝至本地流程。


为本地项目建远程仓库git remote add origin https://github.com/your-name/your-project.git

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值