This repository has been archived by the owner on May 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2022-5-28:add git contributor and add cub push
- Loading branch information
Showing
4 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# 项目添加多个远程仓库 | ||
|
||
[toc] | ||
|
||
## 第一种方式 | ||
|
||
1. 添加一个远程库 名字不能是origin | ||
|
||
``` | ||
git remote add myname https://github.com/C-UB/CUB-learning.git | ||
``` | ||
|
||
2. 查看远程库和地址 | ||
|
||
``` | ||
git remote -v | ||
``` | ||
|
||
![image-20220528162959401](https://s2.loli.net/2022/05/28/KtjHqyGbP3o5VEO.png) | ||
|
||
3. 拉,推 | ||
|
||
``` | ||
git pull myname 远程分支名:本地分支名 | ||
git push myname 本地分支名:远程分支名 | ||
``` | ||
|
||
|
||
|
||
## 第二种方式 | ||
|
||
**(好处是推送时,可以同时推送到另外一个库)** | ||
|
||
1. 添加另外一个远程库 | ||
|
||
``` | ||
git remote set-url --add origin https://github.com/C-UB/CUB-learning.git | ||
``` | ||
|
||
2. 推送 | ||
|
||
``` | ||
git remote -v | ||
git push origin master:master | ||
``` | ||
|
||
3. 取消本地目录下关联的远程库: | ||
|
||
```csharp | ||
git remote remove origin | ||
``` | ||
|
||
|
||
|
||
### 案例: | ||
|
||
```bash | ||
PS C:\Users\smile\Desktop\区块链> git remote set-url --add origin https://github.com/C-UB/CUB-learning.git | ||
PS C:\Users\smile\Desktop\区块链> git remote -v | ||
cub-blockchain https://github.com/C-UB/CUB-learning.git (fetch) | ||
cub-blockchain https://github.com/C-UB/CUB-learning.git (push) | ||
myname https://github.com/C-UB/CUB-learning.git (fetch) | ||
myname https://github.com/C-UB/CUB-learning.git (push) | ||
origin https://github.com/3293172751/golang-rearn.git (fetch) | ||
origin https://github.com/3293172751/golang-rearn.git (push) | ||
origin https://github.com/C-UB/CUB-learning.git (push) | ||
PS C:\Users\smile\Desktop\区块链> | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# 参与本项目 | ||
|
||
|
||
|
||
### 步骤: | ||
|
||
1. 首先在`Github`上`fork`本仓库到你的仓库 | ||
2. `git clone`克隆到本地 | ||
3. 在本地修改对应的代码 | ||
4. `git push`到自己的仓库 | ||
5. 在自己的仓库进行`pull request`的操作 | ||
|
||
`Github`会首先比较你仓库中的项目与目的项目的区别,并且会检查这两者之间是否可以进行合并操作 | ||
|
||
等了一会之后,`Github`提示`Able to merge`可以进行合并后,你就可以点击`Create pull request`了。 | ||
|
||
这里会让你填一个对你修改代码的一个说明,然后就可以真正的创建一个`pull request`了(点击这个`Create pull request`按钮) | ||
|
||
|
||
|
||
### 我们希望什么样的request? | ||
|
||
1. **优化已有代码或者文档** | ||
|
||
![](https://s2.loli.net/2022/05/28/6rnRNubHeXAp54s.png) | ||
|
||
2. **补充和分享项目笔记** | ||
3. **修改错误的代码** | ||
4. **给看不懂的地方一些补充和说明** | ||
|
||
**push代码之前 一定要 先pull最新代码**,否则提交的pr可能会有删除其他push的操作。 | ||
|
||
一个pr 不要修改过多文件,因为一旦有一个 文件修改有问题,就不能合入,影响其他文件的合入了。 | ||
|
||
git add之前,要git diff 查看一下,本次提交所修改的代码是不是 自己修改的,是否 误删,或者误加的文件。 | ||
|
||
提交代码,不要使用git push -f 这种命令,要足够了解 -f 意味着什么。 | ||
|
||
不用非要写出牛逼的代码才能提交PR,只要发现文章中有任何问题,或者错别字,都欢迎提交PR,成为contributor。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters