我在子目录“ gempak / tables”中有一个名为“ gempak-tables”的git子树模块:
$ git config -l | grep -i gempak
[email protected]:Unidata/GEMPAK-Tables.git
remote.gempak-tables.fetch=+refs/heads/*:refs/remotes/gempak-tables/*
$
但是我无法将对子树模块的更改推送到GitHub:
$ git subtree push --prefix=gempak/tables gempak-tables master
git push using: gempak-tables master
X11 forwarding request failed on channel 0
To [email protected]:Unidata/GEMPAK-Tables.git
! [rejected] 89d8f94d010e6677f146608674cf7408eecb4a61 -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:Unidata/GEMPAK-Tables.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
$
即使子树模块看起来是最新的:
$ git subtree pull --prefix=gempak/tables gempak-tables master
X11 forwarding request failed on channel 0
From github.com:Unidata/GEMPAK-Tables
* branch master -> FETCH_HEAD
Already up-to-date.
$
我的git(1)版本:
$ git --version
git version 1.8.3.1
我是子树新手。请帮助。
答案很可能已经由Git subtree - subtree up-to-date but can't push给出
我在此博客评论https://coderwall.com/p/ssxp5q中找到了答案
[如果在推送时遇到
Updates were rejected because the tip of your current branch is behind. Merge the remote changes (e.g. 'git pull')
问题(由于某种原因,特别是git历史记录),则需要嵌套git命令,以便可以强制推送到heroku。例如,以上述示例为例:
git push heroku `git subtree split --prefix pythonapp master`:master --force
您收到的错误表明您的git分支落后。包含最新子树的git分支不是最新的。
[不执行git pull
,不执行git subtree pull