【发布时间】:2016-11-13 22:06:03
【问题描述】:
我不知道我改变了什么,但最近当我尝试使用“git push”向上推我的一个分支时,它试图推到远程分支并掌握。
➜ module1 git:(my-branch) git push
Counting objects: 40, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (25/25), done.
Writing objects: 100% (40/40), 3.68 KiB | 0 bytes/s, done.
Total 40 (delta 14), reused 0 (delta 0)
To git@github.corp.company.com:Project-1/SomeProject.git
1000000..000000e my-branch -> my-branch
! [rejected] master -> master (non-fast-forward)
幸运的是,每次发生这种情况时,我都会收到一条被拒绝的消息,因为我的分支一直落后于 master。我以前只能输入 git push,它只会推送我正在跟踪的分支。我查看了我的 git 配置,它看起来不应该推动掌握。
[remote "origin"]
url = git@github.corp.company.com:Project-1/SomeProject.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "my-branch"]
remote = origin
merge = refs/heads/my-branch
有什么办法可以防止这种情况发生?
【问题讨论】:
标签: git git-branch git-push