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

Posted smj1990~有梦为马

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git上传代码,合并代码,分支相关相关的知识,希望对你有一定的参考价值。

1.上传本地代码到git:
(1)git remote add origin [email protected]: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 (分支名前的冒号代表删除)

以上是关于git上传代码,合并代码,分支相关的主要内容,如果未能解决你的问题,请参考以下文章

Gitgit常用命令集合

Gitgit常用命令集合

Gitgit常用命令集合

Gitgit常用命令集合

Git Checkout后怎么把代码提交到master

路飞-day5——git 多分支开发git远程仓库ssh方式连接远程仓库协同开发冲突解决线上分支合并远程仓库回滚