On Tue, 29 Sep 2015 05:31:07 -0700 (PDT)
nmh <nidhimitta...@gmail.com> wrote:
> I cloned a git repository, made some changes.. i did git commit ..
> forund that changes are not complete , made some more changes
> to the same files, and now i did git commit again.
> Now i did git review to submit my changes for review..
> Git gives message that there are 2 commits ..
> I want to revert the previous commit ..
> I tried to revert .. it did not allow me to revert previous commit.
> I had to revert this commit and then previous ..
> in this process.. i made a mess by using suggested git rm <path>
> too ..
> Good i took a backup of my changes.
> What should i do to go back to that stage, where i see my changes in
> git diff
> and am able to do git commit and git review cleanly.
You wanted to make a single commit out of the two last commits.
That's the task for `git rebase`:
git rebase -i HEAD~2
and you will be presented with a text editor containing the so-called
"rebase script" containing your last two commits with the action
"pick" for each of them.
The "HEAD~2" revision specification means "two commits past the
current HEAD -- run `git help revisions` to read the manual page
2) Change the action of the second commit to "squash" or "fixup",
save the changes and exit.
3) The rebasing process will continue, replacing your two commits with
a single one containing the changes of both.
Read  for more info.
Please note that you're really urged to read this whole book before
embarking on carrying out serious tasks with Git.
As you can see, trying out random commands without having "a big picture"
in your head rarely helps, and when it does, it does so by pure luck.
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
For more options, visit https://groups.google.com/d/optout.