单分支操作
master->dev1
查看当前是哪个分支
[john@136 mytt]$ git status
# On branch master
#生成dev1分支并切换至dev1分支
[john@136 mytt]$ git checkout -b dev1
#dev1分支会copy所有master分支的内容,推送本地分支dev1至git服务器
[john@136 mytt]$git push --set-upstream origin dev1
Total 0 (delta 0), reused 0 (delta 0)
To git@192.168.213.135:mytt.git
* [new branch] dev1 -> dev1
#在dev1分支上进行相应操作,增删改
[john@136 mytt]$ git add .
[john@136 mytt]$ git commit -m "xx"
[john@136 mytt]$ git push
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (5/5), 401 bytes, done.
Total 5 (delta 0), reused 0 (delta 0)
To git@192.168.213.135:mytt.git
28b2650..f2fdc7f dev1 -> dev1
合并dev1到master上
[john@136 mytt]$git checkout master //先切换到主分支
[john@136 mytt]$git merge dev1
[john@136 mytt]$git push origin master //推送到git服务器端
git 单分支管理
最新推荐文章于 2024-04-22 10:17:20 发布