- 将本地分支的修改提交到远程分支上面
- 先git branch -a
yyy@koridy-251:~/D92/pizza$ git branch
- D92
i8
master
- D92
查看与远程分支的关联信息
vim .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote “origin”]
fetch = +refs/heads/:refs/remotes/origin/
url = ssh://xxx@192.168.100.50/git/H20/pizza.git
[branch “master”]
remote = origin
merge = refs/heads/master
[branch “i8”]
remote = origin
merge = refs/heads/i8
注意:如果远程主机IP不对,会导致连接上不git push
- 将各个branch 同步到origin上面,现在本地有D92, I8,这两个分支同步到远程服务器上面
shuliwu@koridy-251:~/D92/pizza$ git push
Counting objects: 174, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (72/72), done.
Writing objects: 100% (98/98), 1.23 MiB, done.
Total 98 (delta 74), reused 21 (delta 19)
To ssh://xxx@192.168.100.50/git/H20/pizza.git
e3cf46d..8e9a950 D92 -> D92
! [rejected] i8 -> i8 (non-fast-forward)
error: failed to push some refs to ‘ssh://xxx@192.168.100.50/git/H20/pizza.git’
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. ‘git pull’) before pushing again. See the
‘Note about fast-forwards’ section of ‘git push –help’ for details.
- 将各个branch 同步到origin上面,现在本地有D92, I8,这两个分支同步到远程服务器上面
说明:
1. e3cf46d..8e9a950 D92 -> D92 ,D92同步成功
2. ! [rejected] i8 -> i8 (non-fast-forward) ,I8没有成功
我们现在只关心D92所以到此步已经OK