git

git提交到分支

Posted by VK on September 17, 2019

git提交到分支

1.首先查看branch存在的分支

git branch -a

结果:

* (HEAD detached at origin/RVC_Branch_20191225_Time20191224)
  RVC_Branch_20191225_Time20191224
  master
  remotes/origin/AA_Demo_20191213_Tag022320191213B2
  remotes/origin/Bluetooth_Branch_20191226_Tag022620191225B2
  remotes/origin/CarPlay_Branch_20191213_Tag022320191213B2
  remotes/origin/HEAD -> origin/master
  remotes/origin/ListPerf_Branch_20191225_Time20191224
  remotes/origin/QT_Branch_20191223_Tag022420191218B2
  remotes/origin/RVC_Branch_20191225_Time20191224
  remotes/origin/Security_Branch_20191226_Tag022620191225B2
  remotes/origin/USB_IF_Branch_20191126
  remotes/origin/master

2.切换到所需修改分支

git checkout remotes/origin/RVC_Branch_20191225_Time20191224

3.修改对应的内容后,在.git目录下的config,添加要提交的分支信息

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = ssh://uidq1459@gerrit-review:29418/Accord5-Service
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
[remote "review"]
	push = HEAD:refs/for/master
	url = ssh://uidq1459@gerrit-review:29418/Accord5-Service
#以下为添加的分支信息,否则没法git push提交
[remote "RVC_Branch_20191225_Time20191224"]
	push = HEAD:refs/for/RVC_Branch_20191225_Time20191224
	url = ssh://uidq1459@gerrit-review:29418/Accord5-Service
[branch "RVC_Branch_20191225_Time20191224"]
	remote = origin
	merge = refs/heads/RVC_Branch_20191225_Time20191224

4.提交

git push RVC_Branch_20191225_Time20191224