300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 在VS Code中t把分支写的代码合并到master中并提交到远程仓库github上

在VS Code中t把分支写的代码合并到master中并提交到远程仓库github上

时间:2022-07-29 21:51:54

相关推荐

在VS Code中t把分支写的代码合并到master中并提交到远程仓库github上

新建分支dxj,然后把分支dxj写的代码合并到master中并push到远程仓库github中,步骤如下:

1.在当前主分支master中新建分支dxj

E:\projects\ERP\zyyerp-front>git branch dxj

2.在master中切换到分支dxj

E:\projects\ERP\zyyerp-front>git checkout dxj Switched to branch 'dxj'Your branch is up to date with 'origin/dxj'.

3.查看当前分支,命令:git branch 。带有星号的就是当前使用的分支。然后dxj编写自己负责的代码。

E:\projects\ERP\zyyerp-front>git branch* dxjmaster

4.添加所有修改代码至暂存区(local cache),命令git add -A

E:\projects\ERP\zyyerp-front>git add -A

5.快捷提交至本地仓库(local repository) ,命令:git commit -am ‘这里是这次提交写的评论’

E:\projects\ERP\zyyerp-front>git commit -am '开始主页布局'[dxj 088e3e9] '开始主页布局'1 file changed, 23 insertions(+), 3 deletions(-)

6.把分支dxj合并到master之前先要切换分支到mster,切换分支命令:git checkoutbranchName

E:\projects\ERP\zyyerp-front>git checkout masterSwitched to branch 'master'Your branch is up to date with 'origin/master'.

查看是否切换成功

E:\projects\ERP\zyyerp-front>git branchdxj* master

7.把分支dxj写的代码合并到master中,命令:git mergemergeTarget

E:\projects\ERP\zyyerp-front>git merge dxjUpdating 3c89c9d..088e3e9Fast-forwardsrc/components/Home.vue | 26 +++++++++++++++++++++++---1 file changed, 23 insertions(+), 3 deletions(-)

8.主分支master最新代码推送到远程仓库(remote git repository) ,命令:git push

E:\projects\ERP\zyyerp-front>git pushEnumerating objects: 9, done.Counting objects: 100% (9/9), done.Delta compression using up to 8 threadsCompressing objects: 100% (5/5), done.Writing objects: 100% (5/5), 902 bytes | 902.00 KiB/s, done.Total 5 (delta 2), reused 0 (delta 0), pack-reused 0remote: Resolving deltas: 100% (2/2), completed with 2 local objects.To /cn-hyf/zyyerp-front.git3c89c9d..088e3e9 master -> master

9.查看树状态,nothing to commit, working tree clean表示当前修改的代码都同步到远程仓库了。

E:\projects\ERP\zyyerp-front>git statusOn branch masterYour branch is up to date with 'origin/master'.nothing to commit, working tree clean

10.上面的步骤已经把分支dxj写的代码合并到master中了,同时也把master最新代码推送到远程仓库了。最后也要把子分支dxj也推送到远程仓库。

10.1 切换到dxj分支,命令git checkout dxj

E:\projects\ERP\zyyerp-front>git checkout dxjSwitched to branch 'dxj'

10.2 把分支dxj写的代码推送到远程仓库github中,命令git push -u origin dxj

E:\projects\ERP\zyyerp-front>git push -u origin dxj Total 0 (delta 0), reused 0 (delta 0), pack-reused 0remote: remote: Create a pull request for 'dxj' on GitHub by visiting:remote:/cn-hyf/zyyerp-front/pull/new/dxjremote:To /cn-hyf/zyyerp-front.git* [new branch]dxj -> dxjBranch 'dxj' set up to track remote branch 'dxj' from 'origin'.

10.3 查看树状态

E:\projects\ERP\zyyerp-front>git statusOn branch dxjYour branch is up to date with 'origin/dxj'.nothing to commit, working tree clean

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。