git上传代码,合并代码,分支相关

1.上传本地代码到git:
(1)git remote add origin git@gitlab.zhongjiaxin.com:DaWang/wechat-waiwei-hunter-new.git
(2)git add .
(3)git commit -m "注释"
(4)git push -u origin master

2.git分支合并到主干
(1)提交分支代码到分支,然后切换回主干

(2)pull下所有代码

(3)git merge xiahuyouhua02(分支名称)

(4)push所有代码

3.git主干合并到分支
(1)提交分支代码到本地仓库,然后切回主干

(2)pull下所有代码,然后切回分支

(3)git merge master(主干名称)

4.git分支相关
在本地新建一个分支: git branch Branch1
切换到你的新分支: git checkout Branch1
将新分支发布在github上: git push origin Branch1
在本地删除一个分支: git branch -d Branch1
在github远程端删除一个分支: git push origin :Branch1 (分支名前的冒号代表删除)

原文地址:https://www.cnblogs.com/smj1990/p/7765120.html