Remove/add file to some commit [message #1795222] |
Tue, 18 September 2018 15:17 |
|
Dear community,
I wonder how is it possible to remove the file from (or add a file to) previous commit?
I know that I can do it by doing Reset → Mixed in the history and then selecting "correct" list of files and doing commit again. This is so-so OK if the change is to be applied to last (top) commit in the history and the number of changed files is relatively small. But what if several commits before?
So I wonder how can I go it using interactive rebase... I have started interactive rebase, and then:
- Commit viewer does not allow to remove files from the list of staged.
- When I hit Amend button in Git staging view, staged files are not populated to Staged Changes, so I cannot remove them... I only can change the commit message.
I had to help Eclipse from command line:
git checkout "HEAD^1" FileToExcludeFromCommit.java
and then one can continue with "git commit --amend".
Adding a file would be
git add FileToAddToCommit.java
but again, cannot do it from Eclipse as Add to Index had disappeared from context menu.
|
|
|
|
Re: Remove/add file to some commit [message #1795345 is a reply to message #1795244] |
Thu, 20 September 2018 15:41 |
|
Quote:In the project/package explorer, there's "<context menu>→Replace with...→ Previous revision".
I think you miss something. Once you have started interactive rebase, there is no Replace with...→ Previous revision
Quote:There are also "Branch, Tag, or Reference..." or "Commit..." in that context menu.
I don't see those items. Again, when not in interactive rebase, they are present.
So the question how to modify commit deeper than HEAD is still an open question.
As for interactive rebase, how can I do the following. Suppose we have commits:
Now I want the group of files to be removed from the commit A3 and added to commit A2. Or (if other commits namely A2, A1 are just replayed / picked) left as unstaged changes on HEAD.
[Updated on: Thu, 20 September 2018 15:43] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03777 seconds