Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of "You are currently editing a commit"?

Tags:

git

Suddenly appeared:

MacBook-Pro: $ git status
On branch dev
Your branch is up-to-date with 'dropbox/dev'.
You are currently editing a commit while rebasing branch 'Releases' on '72ca998'.
  (use "git commit --amend" to amend the current commit)
  (use "git rebase --continue" once you are satisfied with your changes)

nothing to commit, working directory clean

No changed in the branch. Everything is up to date.

like image 676
user1692333 Avatar asked Jul 06 '15 17:07

user1692333


People also ask

How do I abandon a rebase?

You can run git rebase --abort to completely undo the rebase. Git will return you to your branch's state as it was before git rebase was called. You can run git rebase --skip to completely skip the commit.

How do I edit a commit file?

You can modify the most recent commit in the same branch by running git commit --amend. This command is convenient for adding new or updated files to the previous commit. It is also a simple way to edit or add comments to the previous commit. Use git commit --amend to modify the most recent commit.

What is rebase continue git?

Git gets to the edit dd1475d operation, stops, and prints the following message to the terminal: You can amend the commit now, with git commit --amend Once you are satisfied with your changes, run git rebase --continue. At this point, you can edit any of the files in your project to make any additional changes.


3 Answers

git rebase --abort should abort the rebase operation and return to the previous state. But to be sure, what commands did you enter before?

edit: the output of git reflog can show you where the rebase started, it would look something like

7d0b010 HEAD@{0}: rebase finished: returning to refs/heads/bran
7d0b010 HEAD@{1}: rebase: adding file in branch
a7e6693 HEAD@{2}: rebase: checkout master
a7e6693 HEAD@{3}: commit: adding file in master
4c00dd7 HEAD@{4}: checkout: moving from bran to master
3cb192a HEAD@{5}: commit: adding file in branch
like image 142
Andreas Duering Avatar answered Oct 19 '22 19:10

Andreas Duering


If you end up in this state but you need to keep changes:

  1. Make a backup branch of the current branch: git branch my-backup
  2. On the current branch abort the rebase: git rebase --abort
  3. Merge changes from the backup branch created in step 1: git merge my-backup
like image 40
csknk Avatar answered Oct 19 '22 18:10

csknk


try to use git rebase --quit if git rebase --abort failed.

git rebase --quit completely discards the changes.

like image 3
user1455180 Avatar answered Oct 19 '22 19:10

user1455180