git壁球从被跟踪的树枝上发散

git壁球从被跟踪的树枝上发散,git,squash,Git,Squash,我正试图从github存储库(以及我的内部gitolite服务器)中跟踪的分支中挤压一些提交。我的问题是,正如在中所解释的,我正在重定基址,挤压已经完成,但是我的分支与github one不同,我无法将更改推送到它 最初,我更新了我的分支: amateo@joshua:~/puppetcode/apache$ git status On branch squash_test Your branch is up-to-date with 'github/squash_test'. Untrack

我正试图从github存储库(以及我的内部gitolite服务器)中跟踪的分支中挤压一些提交。我的问题是,正如在中所解释的,我正在重定基址,挤压已经完成,但是我的分支与github one不同,我无法将更改推送到它

最初,我更新了我的分支:

amateo@joshua:~/puppetcode/apache$ git status
On branch squash_test
Your branch is up-to-date with 'github/squash_test'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    nohup.out
    spec.log
    spec/acceptance/nodesets.kk/
    tests/spec_dot.pp

nothing added to commit but untracked files present (use "git add" to track)
在编辑屏幕中:

pick 9e027da Fix allignment                                                          
squash 35cb85e Move template to fixtures directory (as it is only for rspec tests)   
squash bce9951 A more complete acceptance test.                                      
squash 0c3f836 Add apache::dotconf documentation                                     
squash 82f76d5 errata                                                                
squash c51f6b2 Add apache::dotconf parameters' documentation                         
squash 121881d Add apache::dotconf parameters' documentation                         

# Rebase b1ddc75..121881d onto b1ddc75                                               
...
重设基础完成后,我得到:

[detached HEAD 9f1ce65] Fix allignment
 4 files changed, 101 insertions(+), 3 deletions(-)
 rename {templates => spec/fixtures/templates}/spec.erb (100%)
Successfully rebased and updated refs/heads/squash_test.
但是,我的分支已经偏离了上游,所以我无法推动这些变化:

amateo@joshua:~/puppetcode/apache$ git status
On branch squash_test
Your branch and 'github/squash_test' have diverged,
and have 1 and 11 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
...
然后,如果我运行git pull,提交更改就会丢失


有什么帮助吗?

您正在更改git历史记录。您需要强制推送(从而覆盖远程历史记录),或者将更改推送到新分支。我通常在需要重基时做后者


另外,在重新设置基础之前,请确保您执行了一个
git pull

似乎是一个
git push-github+squash\u测试
执行了我需要的操作
[detached HEAD 9f1ce65] Fix allignment
 4 files changed, 101 insertions(+), 3 deletions(-)
 rename {templates => spec/fixtures/templates}/spec.erb (100%)
Successfully rebased and updated refs/heads/squash_test.
amateo@joshua:~/puppetcode/apache$ git status
On branch squash_test
Your branch and 'github/squash_test' have diverged,
and have 1 and 11 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
...