1

I need to update an earlier file but I need to modify it in the place that it was update before, is it possible?

... commit A (Add fileA, Add fileB) --> commit B (update file B) ...--> HEAD

I need to go to commit B and rewrite the file and keep the same structure.

I'm working in my branch and it was still not merged so I wont have problems with others developers. Someone recommend me use rebase but I don't understand how to use it to solve this problem.

Thanks in advance.

  • Your title implies that you've already pushed this commit ("earlier file pushed"), but the body of your question implies that you haven't ("it was still not merged"). If you're in the latter case, you're good, but in the former case, if you've already published your work, you don't want to rewrite history. – Cascabel May 16 '11 at 02:30
  • possible duplicate of [How can I continue merging after a double-modify?](http://stackoverflow.com/questions/5697184/how-can-i-continue-merging-after-a-double-modify) – rtn May 16 '11 at 06:09
  • 1
    @Jefromi I think he's saying he's pushed it, but noone's merged it, so repushing it would not cause issues. – Max Nanasy Jul 27 '12 at 10:12

1 Answers1

0

Commit your changes to file B with the --amend flag. It'll put the final state of the files onto the last commit, and give you an opportunity to update the commit comment.

Dan Ray
  • 21,623
  • 6
  • 63
  • 87
  • thanks for the response, I've solved it using this post http://stackoverflow.com/questions/5697184/how-can-i-continue-merging-after-a-double-modify – Franco Brusatti May 16 '11 at 00:23