Skip to content

Fails to move last file in commit #5

@akeeton

Description

@akeeton

If I have a git log that looks like this:

* 178f6fb (HEAD -> fixup, master) Add forgotten foo.h
| A     foo.h
* e7ffe47 Include foo.h in foo.c (whoops! forgot to add foo.h)
| M     foo.c
* bdfdc03 create foo.c
| A     foo.c
* 973bb06 initial commit
  A     .gitignore

And if I run mv-changes 178f6fb e7ffe47 foo.h, I get this output:

Moving changes of 'foo.h' down to the tree
Source:
178f6fb (HEAD -> fixup, master) Add forgotten foo.h
A       foo.h
Destination:
e7ffe47 Include foo.h (whoops! forgot to add foo.h)
In case of troubles to revert any changes use:
    git reset --hard 178f6fb
interactive rebase in progress; onto bdfdc03
Last commands done (3 commands done):
   fixup f3e23c5 fixup! Include foo.h (whoops! forgot to add foo.h)
   pick 178f6fb Add forgotten foo.h
Next command to do (1 remaining command):
   pick 088e18c tmp - will be deleted automatically
You are currently rebasing.

nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git cherry-pick --skip'
Could not apply 178f6fb... Add forgotten foo.h
Warning: you are leaving 2 commits behind, not connected to
any of your branches:

  f3e23c5 fixup! Include foo.h (whoops! forgot to add foo.h)
  088e18c tmp - will be deleted automatically

If you want to keep them by creating a new branch, this may be a good time
to do so with:

 git branch <new-branch-name> f3e23c5

Switched to branch 'fixup'

Here's part of the interactive rebase:

pick e7ffe47 Include foo.h (whoops! forgot to add foo.h)
fixup bf3be31 fixup! Include foo.h (whoops! forgot to add foo.h)
pick 178f6fb Add forgotten foo.h
pick cc365bb tmp - will be deleted automatically

# Rebase bdfdc03..bf3be31 onto cc365bb (4 commands)

In the aftermath, my git log looks like this:

* 178f6fb (master) Add forgotten foo.h
| A     foo.h
* e7ffe47 (HEAD -> fixup) Include foo.h in foo.c (whoops! forgot to add foo.h)
| M     foo.c
* bdfdc03 create foo.c
| A     foo.c
* 973bb06 initial commit
  A     .gitignore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions