Git

  1. fork 原仓库
  2. 克隆到本地

git clone

  1. 创建新分支,并切换到新分支

git checkout -b <newBranch>

3.5:编写代码

  1. commit修改

git commit

  1. 推送<newBranch>到github

git push origin <newBranch>

  1. 在github切到新分支,发起pr
  2. pr被合并后,在github上删除<newBranch>。 并从主仓库更新GitHub上,自己仓库的master分支。
  3. 切回本地master分支

git checkout master

  1. 删除已被合并的<newBranch>分支

git branch -d <newBranch>

  1. 更新master

git pull

新的一轮开发,回到第3步开始。

 

ps 常见问题

git push无效  修改git代理

在使用代理时,我们发现使用git无法拉取远程代码,这是由于vpn代理后,端口改变导致的,这是需要设置git代理

git config --global http.proxy '127.0.0.1:7890'

git config --global https.proxy '127.0.0.1:7890'

7890是使用代理的端口号,根据自己实际情况填写

 

ps 3.5 步骤细节:

修改完代码,通过 git status可以看到修改了哪些。

如果所有修改都要提交,可以简单地使用 git add .

之后使用 git commit -m "本次提交做了什么事,概括在这里"(也就是上面写的 git commit加了 message 的版本)

 

 

posted @ 2023-03-29 17:47  java摩卡,一滴不撒  阅读(17)  评论(0)    收藏  举报