git 创建本地分支、提交到远程分支

1、查看本地分支:

$ git branch
master
* mutilrecall

 查看远程分支:
$ git branch -a
master
* mutilrecall
remotes/origin/master
remotes/origin/mutilrecall
注:其中,remotes开头的代表是远程分支。


2、创建本地分支,并切换到分支:

$ git branch test

kevinliu@TP-A1116-L MINGW64 /e/workspace_ttengine/ttengine (mutilrecall)
$ git checkout test
Switched to branch 'test'

3、本地分支关联远程分支:
在本地test分支上修改了代码后,需要提交到远程,这时就需要关联远程的某个远程分支,操作如下:

1)本地提交:

git gui


2)push到远程
$ git push origin test:test
Counting objects: 15, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (15/15), 927 bytes | 0 bytes/s, done.
Total 15 (delta 7), reused 7 (delta 0)
remote:
remote: Create merge request for test:
remote: http://gitlab.avc.domain/ttengine/ttengine/merge_requests/new?merge_request%5Bsource_branch%5D=test
remote:
To http://gitlab.avc.domain/ttengine/ttengine.git
* [new branch] test -> test

注:第一次无法pull,只能push
注:如果不写远程分支名称,则默认和本地分支同名,这时命令为:$ git push origin test


3)从远程pull:

$ git pull origin test:test
Already up-to-date.

注:如果不写本地分支名称,则默认和远程分支同名,这时命令为:$ git pull origin test:

3、从远程分支上下代码:

$ git clone -b mutilrecall http://gitlab.avc.domain/ttengine/ttengine.git

clone远程仓库到制定目录:

git clone xxx.git "指定目录"


来源:CSDN
原文:https://blog.csdn.net/liuxiao723846/article/details/55191669

转载于:https://www.cnblogs.com/JeromeZ/p/9415800.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值