我不知道我做得对不对,显然我不是。
我不熟悉变基。而且我并不是git总体上的主要忍者大师......已经做了一段时间了但是这是通过合并做出来的,现在我试图坚持使用我更喜欢的变基。
我的问题:我似乎无法再次变色,我不断收到您在下面看到的错误。 updates were rejected
。并且这个消息并没有真正解释发生了什么,或者如何解决它,即使它可能对某些git大师有所帮助:)。
我认为发生的事情是我先将代码推送一次而不进行首次调整,最后得到一个独立的头部并最终进行合并而不是rebase。正如你所看到的,我的树不再是一条直线:
宝贝!我通过命令行完成了大部分工作,但是当我想查看树时,很多更好看。
以下是我采取的让我陷入困境的步骤: ``` 分支机构/主页xxxx-log-in✔
▶ ga。
branches/homepage xxxx-log-in ✗
▶ gcmsg"已删除package.json中的代理条目,正在尝试对API调用进行问题排查"
[xxxx-log-in 0fb184d] removed proxy entry in package.json,
was trying to troubleshoot API call
1 file changed, 6 deletions(-)
branches/homepage xxxx-log-in ✔ 0m
▶ ga。
branches/homepage xxxx-log-in ✔
▶ git rebase -i develop
[detached HEAD bb5fdb3] problem with call to API - getting 403
Date: Fri May 26 11:04:35 2017 -0500
22 files changed, 185 insertions(+), 91 deletions(-)
create mode 100644 src/client/reducers/AuthReducer.js
create mode 100644 src/test/integration/api.integration.spec.js
rename src/test/{unit => }/testImports.js (76%)
Successfully rebased and updated refs/heads/xxxx-log-in.
branches / homepage xxxx-log-in✔
▶ git push origin xxxx-log-in
To https://github.com/xxxx
! [rejected] xxxx-log-in -> xxxx-log-in (non-fast-forward)
error: failed to push some refs to 'https://github.com/xxxx'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
branches/homepage xxxx-log-in ✔
▶ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> xxxx-log-in
branches/homepage xxxx-log-in ✔
▶ git pull origin xxxx-log-i n
fatal: Couldn't find remote ref xxxx-log-in
branches/homepage xxxx-log-in ✔
▶ git push
fatal: The current branch xxxx-log-in has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin xxxx-log-in
branches/homepage xxxx-log-in ✔
▶ git push --set-upstream origin xxxx-log-in
To https://github.com/xxxx
! [rejected] xxxx-log-in -> xxxx-log-in (non-fast-forward)
error: failed to push some refs to 'https://github.com/xxxx'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
branches/homepage xxxx-log-in ✔
▶ git status
On branch xxxx-log-in
nothing to commit, working tree clean
branches/homepage w1-user-can-log-in ✔
▶ git pull --ff-only
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> xxxx-log-in
branches/homepage xxxx-log-in ✔
▶ git pull origin xxxx-log-in
From https://github.com/xxxx
* branch xxxx-log-in -> FETCH_HEAD
Auto-merging package.json
Merge made by the 'recursive' strategy.
package.json | 6 ++++++
1 file changed, 6 insertions(+)
branches/homepage xxxx-log-in ✔
▶ ga。
branches/homepage xxxx-log-in ✗
▶g ** cmsg&#34;在package.json中删除了代理条目,试图
troubleshoot API call"**
[xxxx-log-in db91b96] removed proxy entry in package.json, was trying to troubleshoot API call
1 file changed, 6 deletions(-)
branches/homepage xxxx-log-in ✔
▶ git rebase -i develop
[*detached* HEAD 47a599c] added integration test script to package.json
Date: Fri May 26 11:15:25 2017 -0500
2 files changed, 37 deletions(-)
delete mode 100644 src/test/integration/api-integration-spec.js
Successfully rebased and updated refs/heads/xxxx-log-in.
branches/homepage xxxx-log-in ✔
▶ git push origin xxxx-log-in
To https://github.com/xxxx
! [rejected] xxxx-log-in -> xxxx-log-in (non-fast-forward)
error: failed to push some refs to 'https://github.com/xxxx'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
branches/homepage xxxx-log-in ✔
▶ git checkout xxxx-log-in
Already on 'xxxx-log-in'
branches/homepage xxxx-log-in ✔
▶ git pull origin xxxx-log-in
From https://github.com/xxxx
* branch xxxx-log-in -> FETCH_HEAD
Auto-merging package.json
Merge made by the 'recursive' strategy.
package.json | 6 ++++++
1 file changed, 6 insertions(+)
branches/homepage xxxx-log-in ✔
▶ git push
fatal: The current branch xxxx-log-in has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin xxxx-log-in
branches/homepage xxxx-log-in ✔
▶ git push --set-upstream origin xxxx-log-in
Counting objects: 10, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 1.26 KiB | 0 bytes/s, done.
Total 10 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), completed with 4 local objects.
To https://github.com/xxxx
55aaad5..59507fb xxxx-log-in -> xxxx-log-in
Branch w1-user-can-log-in set up to track remote branch xxxx-log-in from origin.
branches/homepage xxxx-log-in ✔
▶ ga。
branches/homepage xxxx-log-in ✗
▶ gcmsg&#34;从package.json删除代理&#34;
[xxxx-log-in 8f7363f] removed proxy from package.json
1 file changed, 1 insertion(+), 6 deletions(-)
branches/homepage xxxx-log-in ✔
▶ git rebase -i develop
Successfully rebased and updated refs/heads/xxxx-log-in.
branches/homepage xxxx-log-in ✔
▶ git push origin xxxx-log-in
To https://github.com/xxxx
! [rejected] xxxx-log-in -> xxxx-log-in (fetch first)
***error: failed to push some refs to 'https://github.com/xxxx'***
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
branches/homepage xxxx-log-in ✔
▶ git pull origin xxxx-log-in
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 7 (delta 4), reused 7 (delta 4), pack-reused 0
Unpacking objects: 100% (7/7), done.
From https://github.com/xxxx
* branch xxxx-log-in -> FETCH_HEAD
59507fb..4b13f34 xxxx-log-in -> origin/xxxx-log-in
Auto-merging package.json
Merge made by the 'recursive' strategy.
package.json | 6 ++++++
src/test/integration/api.integration.spec.js | 9 ++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
branches/homepage xxxx-log-in ✔
▶ ga。
branches/homepage xxxx-log-in ✗
▶ gcmsg&#34;删除了所有会话实例 - 不需要&#34;
[xxxx-log-in d37a719] removed all instances of session - not needed
5 files changed, 8 insertions(+), 13 deletions(-)
branches/homepage xxxx-log-in ✔
▶ git rebase -i develop
Successfully rebased and updated refs/heads/xxxx-log-in.
xxx/branches/homepage xxxx-log-in ✔
▶ git push origin xxxx-log-in
To https://github.com/xxxx
! [rejected] xxxx-log-in -> xxxx-log-in (non-fast-forward)
error: failed to push some refs to 'https://github.com/xxxx/xxx'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
答案 0 :(得分:0)
要解决您的问题,您需要:
git reset HEAD^2 # fix local history
git push -fu origin xxxx-log-in # force push and set upstream on remote
这假设您仍然在屏幕截图中的位置。