其他分享
首页 > 其他分享> > 5.多人开发git操作

5.多人开发git操作

作者:互联网

命令行操作步骤

git  add .
git  commit -m '提交的备注信息'
git  push -u origin dev

// 1.首先切换到master分支上
git checkout master 
// 2.如果是多人开发的话 需要把远程master上的代码pull下来             
git pull origin master  
// 3.然后我们把dev分支的代码合并到master上
git merge dev 
// 4.然后查看状态及执行提交命令
git status

On branch master
Your branch is ahead of 'origin/master' by 12 commits.
  (use "git push" to publish your local commits)
nothing to commit, working tree clean
// 上面的意思就是你有12个commit,需要push到远程master上 

// 5、有冲突的话,通过IDE解决冲突;

// 6、解决冲突之后,将冲突文件提交暂存区
git add 冲突文件

// 7、提交merge之后的结果
git commit
如果不是使用git commit -m "备注" ,那么git会自动将合并的结果作为备注,提交本地仓库;

// 8、本地仓库代码提交远程仓库
git push origin master
git将分支合并到分支,将master合并到分支的操作步骤是一样的。

其他命令:

更新远程分支列表
git remote update origin --prune

查看所有分支
git branch -a

删除远程分支Chapater6
git push origin --delete Chapater6

删除本地分支 Chapater6
git branch -d Chapater6

参考网址

  1. https://www.jianshu.com/p/26d050497abb
  2. https://www.cnblogs.com/linjiqin/p/7756164.html

标签:origin,git,开发,master,多人,push,commit,分支
来源: https://www.cnblogs.com/lexie-w/p/15232471.html