git创建子分支并合并到主分支相关命令

it2024-11-15  2

一,查看当前分支

git branch * master

二,创建并跳转到子分支上

git checkout -b dev Switched to a new branch 'dev'

三,再次查看分支

git branch * dev master

四,将子分支推送的git上

git push origin HEAD -u Enumerating objects: 23, done. Counting objects: 100% (23/23), done. Delta compression using up to 4 threads Compressing objects: 100% (12/12), done. Total 12 (delta 10), reused 0 (delta 0) remote: Resolving deltas: 100% (10/10) remote: Updating references: 100% (1/1) * [new branch] HEAD -> dev Branch 'dev' set up to track remote branch 'dev' from 'origin'.

五,切换到master分支上

git checkout master Switched to branch 'master' Your branch is ahead of 'origin/master' by 1 commit.

六,拉取远程master上的代码

git pull origin master * branch master -> FETCH_HEAD Already up to date.

七,合并dev分支上的代码

git merge dev Updating 75464a7..d93dda3 Fast-forward 1 file changed, 1 insertion(+), 1 deletion(-)

八,查看状态

git status On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean

九,提交到master

git push origin master Total 0 (delta 0), reused 0 (delta 0) remote: Processing changes: done remote: Updating references: 100% (1/1) To git.code.tencent.com:yunque/agent-web-management.git e3eba88..d93dda3 master -> master

参考文章:https://blog.csdn.net/daerzei/article/details/79530418 参考文章:https://www.jianshu.com/p/26d050497abb

最新回复(0)