在 `git rebase --abort` 和 origin remove 之后继续 rebase
continue rebase after `git rebase --abort` and origin remove
我在我的存储库中添加了一个新的遥控器。然后我执行 git reset --hard d3d52cee3cf112f30bd4a19611ed34e025d10120
强制 HEAD
重置并且它起作用了。我继续工作。在采取其他行动后,我试图将我的工作推向原点,但失败了。当我尝试解决问题时,我会产生冲突,在解决它们之前,我会 git rebase --abort
并放弃我在两者之间提交的所有内容。我怎样才能取回我在 运行 命令 git rebase --abort
之前所做的一切?
这几乎是我所做的一切:
mustaq@Dell /opt/lampp/htdocs/wee $ git push origin master
^C
mustaq@Dell /opt/lampp/htdocs/wee $ git remote add origin
https://hellomustaq@bitbucket.org/mobilelili/laravel2.git
fatal: remote origin already exists.
mustaq@Dell /opt/lampp/htdocs/wee $ git remote -v
origin https://sazaldhaka@bitbucket.org/mobilelili/laravelbackend.git
(fetch)
origin https://sazaldhaka@bitbucket.org/mobilelili/laravelbackend.git
(push)
mustaq@Dell /opt/lampp/htdocs/wee $ git remove rm origin
git: 'remove' is not a git command. See 'git --help'.
Did you mean this?
remote
mustaq@Dell /opt/lampp/htdocs/wee $ git remote rm origin
mustaq@Dell /opt/lampp/htdocs/wee $ git remote add origin
https://hellomustaq@bitbucket.org/mobilelili/laravel2.git
mustaq@Dell /opt/lampp/htdocs/wee $ git add .
mustaq@Dell /opt/lampp/htdocs/wee $ git commit -m "draft"
[master 7afb7d9] draft
6 files changed, 238 insertions(+), 89 deletions(-)
create mode 100644 resources/views/table.blade.php
mustaq@Dell /opt/lampp/htdocs/wee $ git status
On branch master
fatal: Could not open file .git/rebase-merge/done for reading: No such
file or directory
mustaq@Dell /opt/lampp/htdocs/wee $ git remote -v
origin https://hellomustaq@bitbucket.org/mobilelili/laravel2.git
(fetch)
origin https://hellomustaq@bitbucket.org/mobilelili/laravel2.git
(push)
mustaq@Dell /opt/lampp/htdocs/wee $ rebase --abort
rebase: command not found
mustaq@Dell /opt/lampp/htdocs/wee $ git rebase --abort
mustaq@Dell /opt/lampp/htdocs/wee $ git status
On branch master
nothing to commit, working directory clean
您可以使用 git reflog 列出 HEAD
指向的提交。在那里你可以找到你的 git rebase --abort
之前的提交,你可以强制你的 HEAD
到 return 它。
示例:
$ git reflog
a9646cd HEAD@{0}: rebase: aborting
4821905 HEAD@{1}: rebase: checkout test
a9646cd HEAD@{2}: commit: 3
177bb91 HEAD@{3}: checkout: moving from test to master
4821905 HEAD@{4}: commit: 2
177bb91 HEAD@{5}: checkout: moving from master to test
177bb91 HEAD@{6}: commit (initial): 1
$ git reset --hard 4821905
HEAD is now at 4821905 2
我在我的存储库中添加了一个新的遥控器。然后我执行 git reset --hard d3d52cee3cf112f30bd4a19611ed34e025d10120
强制 HEAD
重置并且它起作用了。我继续工作。在采取其他行动后,我试图将我的工作推向原点,但失败了。当我尝试解决问题时,我会产生冲突,在解决它们之前,我会 git rebase --abort
并放弃我在两者之间提交的所有内容。我怎样才能取回我在 运行 命令 git rebase --abort
之前所做的一切?
这几乎是我所做的一切:
mustaq@Dell /opt/lampp/htdocs/wee $ git push origin master
^C
mustaq@Dell /opt/lampp/htdocs/wee $ git remote add origin
https://hellomustaq@bitbucket.org/mobilelili/laravel2.git
fatal: remote origin already exists.
mustaq@Dell /opt/lampp/htdocs/wee $ git remote -v
origin https://sazaldhaka@bitbucket.org/mobilelili/laravelbackend.git
(fetch)
origin https://sazaldhaka@bitbucket.org/mobilelili/laravelbackend.git
(push)
mustaq@Dell /opt/lampp/htdocs/wee $ git remove rm origin
git: 'remove' is not a git command. See 'git --help'.
Did you mean this?
remote
mustaq@Dell /opt/lampp/htdocs/wee $ git remote rm origin
mustaq@Dell /opt/lampp/htdocs/wee $ git remote add origin
https://hellomustaq@bitbucket.org/mobilelili/laravel2.git
mustaq@Dell /opt/lampp/htdocs/wee $ git add .
mustaq@Dell /opt/lampp/htdocs/wee $ git commit -m "draft"
[master 7afb7d9] draft
6 files changed, 238 insertions(+), 89 deletions(-)
create mode 100644 resources/views/table.blade.php
mustaq@Dell /opt/lampp/htdocs/wee $ git status
On branch master
fatal: Could not open file .git/rebase-merge/done for reading: No such
file or directory
mustaq@Dell /opt/lampp/htdocs/wee $ git remote -v
origin https://hellomustaq@bitbucket.org/mobilelili/laravel2.git
(fetch)
origin https://hellomustaq@bitbucket.org/mobilelili/laravel2.git
(push)
mustaq@Dell /opt/lampp/htdocs/wee $ rebase --abort
rebase: command not found
mustaq@Dell /opt/lampp/htdocs/wee $ git rebase --abort
mustaq@Dell /opt/lampp/htdocs/wee $ git status
On branch master
nothing to commit, working directory clean
您可以使用 git reflog 列出 HEAD
指向的提交。在那里你可以找到你的 git rebase --abort
之前的提交,你可以强制你的 HEAD
到 return 它。
示例:
$ git reflog
a9646cd HEAD@{0}: rebase: aborting
4821905 HEAD@{1}: rebase: checkout test
a9646cd HEAD@{2}: commit: 3
177bb91 HEAD@{3}: checkout: moving from test to master
4821905 HEAD@{4}: commit: 2
177bb91 HEAD@{5}: checkout: moving from master to test
177bb91 HEAD@{6}: commit (initial): 1
$ git reset --hard 4821905
HEAD is now at 4821905 2