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

在VS Code中t把分支写的代码合并到master中并提交到远程仓库github上新建分支 dxj 然后把分支 dxj 写的代码合并到 master 中并 push 到远程仓库 github 中 步骤如下 1 在当前主分支 master 中新建分支 dxj E projects ERP zyyerp front gt git branch dxj 2 在 master 中切换到分支 dxj E projects ERP

大家好,我是讯享网,很高兴认识大家。

新建分支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 * dxj master 

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 checkout branchName

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

查看是否切换成功


讯享网

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

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

讯享网E:\projects\ERP\zyyerp-front>git merge dxj Updating 3c89c9d..088e3e9 Fast-forward src/components/Home.vue | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) 

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

E:\projects\ERP\zyyerp-front>git push Enumerating objects: 9, done. Counting objects: 100% (9/9), done. Delta compression using up to 8 threads Compressing 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 0 remote: Resolving deltas: 100% (2/2), completed with 2 local objects. To https://github.com/cn-hyf/zyyerp-front.git 3c89c9d..088e3e9 master -> master 

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

讯享网E:\projects\ERP\zyyerp-front>git status On branch master Your branch is up to date with 'origin/master'. nothing to commit, working tree clean 
E:\projects\ERP\zyyerp-front>git checkout dxj Switched 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 0 remote: remote: Create a pull request for 'dxj' on GitHub by visiting: remote: https://github.com/cn-hyf/zyyerp-front/pull/new/dxj remote: To https://github.com/cn-hyf/zyyerp-front.git * [new branch] dxj -> dxj Branch 'dxj' set up to track remote branch 'dxj' from 'origin'. 

10.3 查看树状态

E:\projects\ERP\zyyerp-front>git status On branch dxj Your branch is up to date with 'origin/dxj'. nothing to commit, working tree clean 
小讯
上一篇 2025-03-05 23:22
下一篇 2025-04-08 09:04

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/65040.html