Merging two commits on the same branch

I have done a commit no. X for a file.
say, its commit 1000 rev no. for a.py,

after a few minutes i committed the changes on the same file, a.py and the rev is 1001.

The 1001 is at different place than on 1000's commit.

Is there any way to merge the commits into one, because the changes are in the same file.

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
Tim Penhey
Solved:
Last query:
Last reply:
Revision history for this message
Tim Penhey (thumper) said :
#1

I don't understand what you mean by "The 1001 is at different place than on 1000's commit."

Why are you wanting to change the history?

If you do really want to though, look at `bzr help uncommit`.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#2

I meant by "The 1001 is at different place than on 1000's commit" is,

the rev 1000 belongs to one function def abc(). i have committed changes to that function.

Now i am working on function def xyz(), and now i commit the changes.
its 1001.

so ultimately, the both commits are on different place of code for the same file a.py..

If i merge them into a single commit, it wont get conflicts.

So i want them as a single commit. so meaninglessly rev no. are not more.

thanks.

Revision history for this message
Best Tim Penhey (thumper) said :
#3

You shouldn't get conflicts any way if the edits are in different functions one after the other.

What you are wanting to do is not "normal" behaviour for bzr. However if you are effectively wanting to rewrite history, you can do the following:
  $ # Uncommit the last revision
  $ bzr uncommit
  $ # Uncommit the one before that
  $ bzr uncommit
  $ # Recommit both changes together
  $ bzr commit -m "Recommit msg"

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#4

Yes i think this shoudl work.

Thanks.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#5

Thanks Tim Penhey, that solved my question.