码云Pull Request的使用

码云Pull Request的使用

【使用前的配置】

生成ssh:

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test
$ ssh-keygen -t rsa -C "gitee.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/lenovo/.ssh/id_rsa):
/c/Users/lenovo/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/lenovo/.ssh/id_rsa.
Your public key has been saved in /c/Users/lenovo/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ReCLQ8nuVqLdgc2lATCwqfrsqKl8hLLLLQKdIBoeEEw gitee.com
The key's randomart image is:
+---[RSA 2048]----+
|+E..o.. ...      |
|.. o o + .       |
|. o   + o o      |
|+o   o = *       |
|=+o.  * S        |
|=oo. + = .       |
|+.. . + .        |
|=*.. .           |
|X=*.             |
+----[SHA256]-----+

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test
$ 

查看public key:

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsqBh3WoP5gQofhmMOhm8TZoPLkrAs8Ykl+zUqiQ4ZAdlk2rxYumG/0VU2Ch77+YfQIYKiD3zA5+jrvA2eAnMmiCgLaFOKA9RcG+zHeqccTFBvHVnay7AuEvaiWUcrVVKydpMwD7/znDOi/onG57GWUSB8IhBHu4RKo53g3RfuCqwKEpL+sWXUb/Um3TQAb9y+MYa6fx+Eb7x/oM98PGwvWqJBgyie0I4Ho0OOU2IwA8JDmxehJ6xpPvY7fOJKbBEYqgJBoKdy9VB6dbP666RkO6hwJw36+3tUCmB9iGCvtIOEzpJAalyQbHdUm5yeHVOEyAxicjNqRlm2xBAP3YlD gitee.com

进入码云的的设置,在“安全设置”中选中“SSH公钥”,将上述公钥复制上去,并点击“确定”。

接着,运行如下命令:

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test
$ ssh -T [email protected]
Hi xxxxxx! You've successfully authenticated, but GITEE.COM does not provide shell access.

【Pull Request使用流程】

首先,将项目git clone下来:

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test
$ git clone https://gitee.com/xxxxxx.git
Cloning into 'xxx'...
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 13 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (13/13), done.

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test
$

然后在本地电脑上进入这个项目的目录,查看当前有哪些分支:

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (master)
$ git branch
* master

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (master)
$

然后添加新的分支new:

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (master)
$ git branch new
lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (master)
$

然后切换到新添加的分支:

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (master)
$ git checkout new
Switched to branch 'new'

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (new)
$

接下来可以对其中的文件进行修改,或是新添加文件,或是删除文件。

修改完后,就推送到码云上:

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (new)
$ git status
On branch new
Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)

        modified:   test.md

no changes added to commit (use "git add" and/or "git commit -a")

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (new)
$ git add .

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (new) 
$ git commit -m "new branch commit"
[new 7e3ea34] new branch commit
 1 file changed, 1 insertion(+), 1 deletion(-)

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (new)
$ git push origin new
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 256 bytes | 256.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Powered By Gitee.com
To https://gitee.com/xxx.git
 * [new branch]      new -> new

lenovo@LAPTOP-8STQ2UUH MINGW64 /Git_Test/xxx (new)
$

这时在码云上就可以看到了新添加的分支了。

你可能感兴趣的:(有趣的尝试)