3

After executing two Git commands to undo a rebase, I am stuck with some errors.

git checkout topic 
git reset --hard origin/topic

Can someone please explain what this is and how is it to be resolved ? I do not want to lose my code again.

git status shows me this

    Last command done (1 command done):
    pick c326b089c8 Revert "Conflicts removed from master, OffscreenCanvas changes ready for merge" Will rebase branch and resolve conflicts. This reverts commit 7357f2e5444bed9e93e1380331464a5332319d09.
   Next command to do (1 remaining command):
   pick 90bec670b4 Changes reverted in conflicting files. OffscreenCanvas API ready to be merged.
  (use "git rebase --edit-todo" to view and edit)
  You are currently editing a commit while rebasing branch 'testing' on '1b0b63edf9'.
  (use "git commit --amend" to amend the current commit)
  (use "git rebase --continue" once you are satisfied with your changes)

  nothing to commit, working tree clean

Thanks in advance !

pchaigno
  • 7,252
  • 2
  • 21
  • 43
Gauraang Khurana
  • 694
  • 1
  • 5
  • 15
  • 2
    It looks like you're stuck in the middle of the rebase. You should be able to end the rebase with 'git rebase --abort'. You may benefit from a visual editor like SourceTree. – Stephen Oct 31 '17 at 14:12
  • @Stephen I do not want to lose my changes. Will the abort command keep my changes ? – Gauraang Khurana Oct 31 '17 at 14:13
  • That really depends. I would suggest making a copy of the files that you have changes in and placing them in a new directory for safe keeping. Then if you lose the changes, you can restore the files. – Stephen Oct 31 '17 at 14:19
  • https://stackoverflow.com/questions/134882/undoing-a-git-rebase – robC Oct 31 '17 at 14:19
  • I downvoted this question because you never [closed out your previous question](https://stackoverflow.com/questions/47029976/github-accidental-changes-in-two-files/47030063?noredirect=1#comment81020696_47030063). – Tim Biegeleisen Oct 31 '17 at 14:24
  • _You_ are responsible for the state of your repo at all times, sort of like being responsible for the front end of your car. If you are struggling with rebasing then you should hit up a tutorial rather than Stack Overflow. – Tim Biegeleisen Oct 31 '17 at 14:25

1 Answers1

7

git rebase --abort will abort the rebase operation and return your repository to its state before starting the rebase. Everything you did since you started the rebase will be lost.

pchaigno
  • 7,252
  • 2
  • 21
  • 43