On Thu, 19 Dec 2013 00:10:35 -0800 (PST)
"Jagadeesh N. Malakannavar" <mnjagade...@gmail.com> wrote:

> May I know how to delete one intermidate commit? 
> For ex: git one line log 
> c4ab7b9 commit 6
> a2396a2 commit 5
> 85020f2 commit 4
> 8779285 commit 3
> 4c0b83b commit 2
> 4498573 commit 1
> I want to delete 
> 8779285 commit 3
> how to do that?

In any case the answer is "use rebasing".

That is, run

git rebase -i 4c0b83b

and follow the instructions.  You *have to* read at least [1] before
proceeding though.  And better yet start with forking a temporary
branch off c4ab7b9 and experimenting on it -- once you're satisfied
with the results just reset whatever branch was pointingat c4ab7b9 when
you started to your new state.

Now the hard part.  "Deleting a commit" is a moot term because it might
mean different things: do you want to completely wipe *the changes*
this commit introduced into the codebase or do you want to just make
the commit itself disappear from the history while having the changes
it introduced to persist?  In the first case you just have to delete it
in the rebase script (see [1]) when rebasing.  In the latter case you
need to squash it into preceeding commit or squash the following commit
into it (or even reorder commits and squash it with some other commit).

1. http://git-scm.com/book/en/Git-Tools-Rewriting-History

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to