[working workflow for importing git to a named branch] (was: graft/rebase without changing the hash)

Uwe Brauer oub at mat.ucm.es
Sat Nov 26 13:58:27 UTC 2022


> Hi Uwe,
> Uwe Brauer <oub at mat.ucm.es> writes:


> No, because the branch name is part of the hash calculation.


> It sounds like what you want is to have the resulting git-hash equal,
> not to have the Mercurial-hash equal. This could in theory be possible
> (because the branch name is not part of the hash-generation in git), but
> I do not know whether it is possible in practice.

> Best wishes,
> Arne

The following surprisingly works, how stable it is I am not sure

* Workflow

The following works

** HG
    1) create a hg repository.
    2) create a named branch main (because this is what github uses now)
    3) hg addremove
    4) hg commit -m "First changeset"
    5) hg book main_bookmark
    6) hg push (to an empty git repository in github)

** GIT 
   1) git clone
   2) git edit commit and push

** HG
Git's changeset is on the default branch not on the main branch, so 
   1) hg phase -d -f -r 2
   2) with evolve enabled hg rebase -s 4 -d 3 (it does not work without evolve)
   3) add more changesets
   4) actualise the bookmark
   5) hg push -f

** GIT

Git pull results in 


hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only

So the best option seems 
git config pull.rebase true   # rebase

Then 
Git pull 

And then everything works smoothly.

Not sure how stable that is however!





-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5673 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20221126/993c8ff0/attachment-0001.p7s>


More information about the Mercurial mailing list