如何pr到别人仓库(无废话)

如何PR到别人仓库(指定分支)

记录一下,之前都是直接master分支,现在记录如何pr到别人仓库的其他分支
首先进入别人仓库然后点击fork到自己仓库
picture 0

picture 1

步骤(以博主自己一个例子为例)

(1)拉取你fork到你仓库

git clone https://github.com/dragonforward/MaixCDK.git

(2)添加原始仓库(也就是你fork的仓库)作为上游(upstream):

git remote add upstream https://github.com/sipeed/MaixCDK.git

(3)切换到你想要的分支(例如我fork的仓库是master分支和dev分支,fork后默认为master分支)

git checkout -b dev upstream/dev

这样你就可以拉取切换并创建一个dev分支并和原始仓库的dev分支

(4)添加你的修改然后commit

git add app_audio
git commit -m "app_audio_source_code"
git push origin dev

然后你得仓库界面就会显示,点击按钮创建pull request然后就ok了

picture 2

博主的整个history过程

  490  git clone https://github.com/dragonforward/MaixCDK.git
  491  cd MaixCDK/
  492  LLS
  493  ls
  494  git remote add upstream https://github.com/sipeed/MaixCDK.git
  495  git fetch upstream
  496  git branch -r
  497  git checkout -b dev upstream/dev
  498  git branch
  499  ls
  500  cd projects/
  501  ls
  502  git add app_audio
  503  git commit -m "app_audio_source_code"
  504  git push origin dev
  505  history

posted @ 2024-07-13 14:33  wuboy19  阅读(32)  评论(0编辑  收藏  举报