[git-users] Re: [and remote branch tracking]
>>> "FC" == Felipe Contreras writes: > On Tue, Apr 18, 2023 at 1:03 AM Uwe Brauer wrote: >> >> > On Mon, Apr 17, 2023 at 3:05 PM Uwe Brauer wrote: >> >> > git push hg-remote >> > remotes/origin/modernize:refs/heads/branches/modernize >> >> Does not push the git branch modernize to the named branch modernize, sorry > It does here. > ( > git init git-repo > cd git-repo > echo one > content > git add content > git commit -m 'one' > ) > hg init hg-repo > ( > git clone git-repo proxy-repo > cd proxy-repo > git remote add -f hg-repo hg::../hg-repo > git push hg-repo remotes/origin/master:refs/heads/branches/master > ) > hg -R hg-repo log > changeset: 0:c8ae0e6c7f3e > branch: master > tag: tip > user:Felipe Contreras > date:Tue Apr 18 02:08:35 2023 -0600 > summary: one I am not arguing with this, what seems not to work is this: git clone g...@gitlab.com:kalthad/matlab-emacs-default.git mkdir mercurial-matlab-emacs-default cd mercurial-matlab-emacs-default hg init cd ../matlab-emacs-default git remote add hg-remote hg::../mercurial-matlab-emacs-default/ git config remote.hg-remote.push 'refs/heads/*:refs/heads/branches/*' git push hg-remote default Result git push hg-remote remotes/origin/strings:refs/heads/branches/strings Or git push hg-remote remotes/origin/modernize:refs/heads/branches/modernize But cd mercurial-matlab-emacs-default hg branches default 671:8d1e8723a028 documentation452:2d98916caa6a (inactive) Before proceeding, the question is, is something wrong with this repository. Because instead of running git push hg-remote remotes/origin/strings:refs/heads/branches/strings I do git checkout strings git push hg-remote strings:branches/strings Then that does not work neither. Ok something is wrong with that repository. I have to check this first, before proceeding. Thanks for your patience. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/874jpdp9um.fsf%40mat.ucm.es. smime.p7s Description: S/MIME cryptographic signature
[git-users] Re: [and remote branch tracking]
On Tue, Apr 18, 2023 at 1:03 AM Uwe Brauer wrote: > > > On Mon, Apr 17, 2023 at 3:05 PM Uwe Brauer wrote: > > > git push hg-remote > > remotes/origin/modernize:refs/heads/branches/modernize > > Does not push the git branch modernize to the named branch modernize, sorry It does here. ( git init git-repo cd git-repo echo one > content git add content git commit -m 'one' ) hg init hg-repo ( git clone git-repo proxy-repo cd proxy-repo git remote add -f hg-repo hg::../hg-repo git push hg-repo remotes/origin/master:refs/heads/branches/master ) hg -R hg-repo log changeset: 0:c8ae0e6c7f3e branch: master tag: tip user:Felipe Contreras date:Tue Apr 18 02:08:35 2023 -0600 summary: one > > Only if you don't specify the refspec, which is the typical way to push. > > You mean, in layman terms, checkout the remote branch? No, checking out means putting the contents of a revision in the current working directory. This is true in all version control systems, including Mercurial. An alias for `hg checkout` is `hg update`. You don't need to checkout a branch to push it, just do: `git push foo` (no refspec). > > git push hg-remote hairyblocks > > > That would be translated to a refspec: > > > git push hg-remote > > refs/heads/hairyblocks:refs/heads/branches/hairyblocks > > > But if you are already specifying the refspec, nothing gets translated. > > > > It does, but you haven't created the local branches, soyou can't do > > `git push foo`, if "foo" doesn't exist. > > > > But you are going to need to do that only once. > > So to sum it up: > > 1. If I wish to push (remote) gitbranches as hg named branches, I have > first >to check them out to have local ones? That seems the strategy I > followed from the >start, but then I understand your comments, that I can somehow >save that step your find at least a faster way No, you don't need to check them out. What I suggested was to use `git switch` to *create* them. Yes, `git switch` also checks them out, but that's an unnecessary step. You can skip that step by doing `git branch` instead of `git switch` (or `git checkout`). But it doesn't matter, the important thing is that they get *created*. But as I already explained, you don't even need to create them. > So you suggested > > > git for-each-ref --format='git switch %(refname:lstrip=3)' > > refs/remotes/origin > > > > Or you can push the commit of a remote branch: > > > > git push hg-remote remotes/origin/modernize:modernize > > That this would save me to step to checkout the branches, but > > git push hg-remote remotes/origin/modernize:modernize git push hg-remote remotes/origin/modernize:refs/heads/branches/modernize Not git push hg-remote remotes/origin/modernize:modernize And this is orthogonal to `git switch`: either you *create* the local branches, or you don't. If you create the branches with `git switch` (or `git branch` or whatever), then you don't need to specify the refspec in `git push`. If you do not create the branches, then you need a refspec (as explained above). -- Felipe Contreras -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/CAMP44s2w0%2BR8D7A8UDFvKR2WFz9AVXVa-ojdfyLbXGwY4KBoSg%40mail.gmail.com.
[git-users] Re: [and remote branch tracking]
> On Mon, Apr 17, 2023 at 3:05 PM Uwe Brauer wrote: > git push hg-remote remotes/origin/modernize:refs/heads/branches/modernize Does not push the git branch modernize to the named branch modernize, sorry > Only if you don't specify the refspec, which is the typical way to push. You mean, in layman terms, checkout the remote branch? > git push hg-remote hairyblocks > That would be translated to a refspec: > git push hg-remote refs/heads/hairyblocks:refs/heads/branches/hairyblocks > But if you are already specifying the refspec, nothing gets translated. > It does, but you haven't created the local branches, soyou can't do > `git push foo`, if "foo" doesn't exist. > But you are going to need to do that only once. So to sum it up: 1. If I wish to push (remote) gitbranches as hg named branches, I have first to check them out to have local ones? That seems the strategy I followed from the start, but then I understand your comments, that I can somehow save that step your find at least a faster way So you suggested > git for-each-ref --format='git switch %(refname:lstrip=3)' > refs/remotes/origin > > Or you can push the commit of a remote branch: > > git push hg-remote remotes/origin/modernize:modernize > That this would save me to step to checkout the branches, but git push hg-remote remotes/origin/modernize:modernize Does not create a named branch. And concerning git for-each-ref --format='git switch %(refname:lstrip=3)' refs/remotes/origin You later told me, UB> But after using the command I obtain UB> UB> git switch HEAD UB> git switch copyright UB> git switch default UB> git switch documentation UB> git switch fontlockhang UB> git switch hairyblocks UB> git switch mac_init UB> git switch modernize UB> git switch shellcomplete UB> git switch strings UB> git switch usage1 UB> git switch wisent-parser FC> Those are *suggestions* of what you should run. It doesn't do FC> anything, and obviously you shouldn't do `git switch HEAD`. So how should this command help me to avoid checking out each remote branch. -- 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/ -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/87h6tdpw04.fsf%40mat.ucm.es. smime.p7s Description: S/MIME cryptographic signature
[git-users] Re: [and remote branch tracking]
On Mon, Apr 17, 2023 at 3:05 PM Uwe Brauer wrote: > > > On Mon, Apr 17, 2023 at 1:19 AM Uwe Brauer wrote: > > > Those are *suggestions* of what you should run. It doesn't do > > anything, and obviously you shouldn't do `git switch HEAD`. > > > The error message is pretty much telling you what to do: > > > git push hg-remote remotes/origin/modernize:refs/heads/modernize > > > Why didn't you try that? > > I did, but the commits where pushed as bookmarks not as named-branches git push hg-remote remotes/origin/modernize:refs/heads/braces/modernize > I thought > git config remote.hg-remote.push 'refs/heads/*:refs/heads/branches/*' > > Would have the effect that I don't need to run > > git push hg-remote > remotes/origin/hairyblocks:refs/heads/hairyblocks:branches/hairyblocks Only if you don't specify the refspec, which is the typical way to push. git push hg-remote hairyblocks That would be translated to a refspec: git push hg-remote refs/heads/hairyblocks:refs/heads/branches/hairyblocks But if you are already specifying the refspec, nothing gets translated. > Or whatever it is. > > I am deeply confused. > > I understood the first (cumbersome) method > > 1. Set up remote: git remote add hg-remote > hg::../mercurial-matlab-emacs-default/ > > 2. Checkout each remote branch > > 3. Run, for example git push default:/branches/default > > So I thought running > git config remote.hg-remote.push 'refs/heads/*:refs/heads/branches/*' > > Would shorten > the command > > git push default:/branches/default > > To > > git push default It does, but you haven't created the local branches, soyou can't do `git push foo`, if "foo" doesn't exist. > If I checkout each branch and push them then everything seems find but > suppose I had 100 branches, I need to checkout each, well But you are going to need to do that only once. > > But you can clone it once, set up all the branches once, push all the > > branches ini order once, and forget about that step. > > > After that you can just pull from one repo and push to another. -- Felipe Contreras -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/CAMP44s0GJf2z4mCyGsoBnDRA9E4VFctPCcDCUFYCSNC%2BfTQHwA%40mail.gmail.com.
[git-users] Re: [and remote branch tracking]
> On Mon, Apr 17, 2023 at 1:19 AM Uwe Brauer wrote: > Those are *suggestions* of what you should run. It doesn't do > anything, and obviously you shouldn't do `git switch HEAD`. > The error message is pretty much telling you what to do: > git push hg-remote remotes/origin/modernize:refs/heads/modernize > Why didn't you try that? I did, but the commits where pushed as bookmarks not as named-branches I thought git config remote.hg-remote.push 'refs/heads/*:refs/heads/branches/*' Would have the effect that I don't need to run git push hg-remote remotes/origin/hairyblocks:refs/heads/hairyblocks:branches/hairyblocks Or whatever it is. I am deeply confused. I understood the first (cumbersome) method 1. Set up remote: git remote add hg-remote hg::../mercurial-matlab-emacs-default/ 2. Checkout each remote branch 3. Run, for example git push default:/branches/default So I thought running git config remote.hg-remote.push 'refs/heads/*:refs/heads/branches/*' Would shorten the command git push default:/branches/default To git push default Now it gets even more absurd I run git push hg-remote default Everything fine. A named branch default is generated. I run git push hg-remote remotes/origin/strings:refs/heads/strings Then a named branch documentation is generated and a bookmark «strings» Why that? I don't know what to say. If I checkout each branch and push them then everything seems find but suppose I had 100 branches, I need to checkout each, well > But you can clone it once, set up all the branches once, push all the > branches ini order once, and forget about that step. > After that you can just pull from one repo and push to another. -- 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/ -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/87pm82p94t.fsf%40mat.ucm.es. smime.p7s Description: S/MIME cryptographic signature
[git-users] Re: [and remote branch tracking]
On Mon, Apr 17, 2023 at 1:19 AM Uwe Brauer wrote: > > > On Sun, Apr 16, 2023 at 2:31 PM Uwe Brauer wrote: > > > You cannot push a branch you don't have. Obviously. > > > But you can create the branches without checking them out, as I > > already explained: > > > git for-each-ref --format='git switch %(refname:lstrip=3)' > > refs/remotes/origin > > Ah, right. Into my HOWTO file *now*. > > But after using the command I obtain > > git switch HEAD > git switch copyright > git switch default > git switch documentation > git switch fontlockhang > git switch hairyblocks > git switch mac_init > git switch modernize > git switch shellcomplete > git switch strings > git switch usage1 > git switch wisent-parser Those are *suggestions* of what you should run. It doesn't do anything, and obviously you shouldn't do `git switch HEAD`. > > git push hg-remote remotes/origin/modernize:modernize > > Well > git push hg-remote remotes/origin/modernize:mac_init > error: The destination you provided is not a full refname (i.e., > starting with "refs/"). We tried to guess what you meant by: > > - Looking for a ref that matches 'mac_init' on the remote side. > - Checking if the being pushed ('refs/remotes/origin/modernize') > is a ref in "refs/{heads,tags}/". If so we add a corresponding > refs/{heads,tags}/ prefix on the remote side. The error message is pretty much telling you what to do: git push hg-remote remotes/origin/modernize:refs/heads/modernize Why didn't you try that? > > It's not clear what would be the best thing to do here because you > > haven't explained your use-case. > > In the foreseeable feature, matlab-emacs should be moved to > github/gitlab and I thought of dealing it with your script (BTW I said > plugin because hg-git calls itself plugin, but since hg is written in > python that makes sense). > > So I have to clone the repository (from gitlab/github and then use your > script, while using the mirror option would be possible, it think the > solution with for-each-ref is what I need) But you can clone it once, set up all the branches once, push all the branches ini order once, and forget about that step. After that you can just pull from one repo and push to another. -- Felipe Contreras -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/CAMP44s0Dy8UqSGPVYLYYYxPSu7o7pKQV0L%3DHOa%2Bj8-AtfZuHbw%40mail.gmail.com.
[git-users] Re: [and remote branch tracking]
> On Sun, Apr 16, 2023 at 2:31 PM Uwe Brauer wrote: > You cannot push a branch you don't have. Obviously. > But you can create the branches without checking them out, as I > already explained: > git for-each-ref --format='git switch %(refname:lstrip=3)' > refs/remotes/origin Ah, right. Into my HOWTO file *now*. But after using the command I obtain git switch HEAD git switch copyright git switch default git switch documentation git switch fontlockhang git switch hairyblocks git switch mac_init git switch modernize git switch shellcomplete git switch strings git switch usage1 git switch wisent-parser Git branch -a still Shows default * modernize remotes/hg-remote/branches/default remotes/hg-remote/branches/modernize remotes/origin/HEAD -> origin/default remotes/origin/copyright remotes/origin/default remotes/origin/documentation remotes/origin/fontlockhang remotes/origin/hairyblocks remotes/origin/mac_init remotes/origin/modernize remotes/origin/shellcomplete remotes/origin/strings remotes/origin/usage1 remotes/origin/wisent-parser error: src refspec mac_init does not match any error: failed to push some refs to 'hg::/home/oub/Push-test/mercurial-matlab-emacs-default' > git push hg-remote remotes/origin/modernize:modernize Well git push hg-remote remotes/origin/modernize:mac_init error: The destination you provided is not a full refname (i.e., starting with "refs/"). We tried to guess what you meant by: - Looking for a ref that matches 'mac_init' on the remote side. - Checking if the being pushed ('refs/remotes/origin/modernize') is a ref in "refs/{heads,tags}/". If so we add a corresponding refs/{heads,tags}/ prefix on the remote side. Neither worked, so we gave up. You must fully qualify the ref. hint: The part of the refspec is a commit object. hint: Did you mean to create a new branch by pushing to hint: 'refs/remotes/origin/modernize:refs/heads/mac_init'? error: failed to push some refs to 'hg::/home/oub/Push-test/mercurial-matlab-emacs-default' > It's not clear what would be the best thing to do here because you > haven't explained your use-case. In the foreseeable feature, matlab-emacs should be moved to github/gitlab and I thought of dealing it with your script (BTW I said plugin because hg-git calls itself plugin, but since hg is written in python that makes sense). So I have to clone the repository (from gitlab/github and then use your script, while using the mirror option would be possible, it think the solution with for-each-ref is what I need) > Normally people push their branches, that they have in the their repos. -- 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/ -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/87cz43uj1y.fsf%40mat.ucm.es. smime.p7s Description: S/MIME cryptographic signature
[git-users] Re: [and remote branch tracking]
On Sun, Apr 16, 2023 at 2:31 PM Uwe Brauer wrote: > > > On Sun, Apr 16, 2023 at 3:01 AM Uwe Brauer wrote: > > > git-remote-hg, and I wouldn't call it a "plugin", git doesn't have > > plugins. It's just a tool. > > > > I'm not sure what's going on here, as I don't have the code of > > `mygit-push-named-branch`, but I suspect it's doing something like: > > > git push hg-remote strings:branches/strings > > > If that's the case I think I already explained to you that you don't > > need to specify the refspec (strings:branches/strings), if the local > > branches have the same name as the remote branches, so you should > > probably name them like "branches/strings", not "strings". > > > Alternatively you can configure git to always push local git branches > > to hg branches: > > > git config remote.hg-remote.push refs/heads/*:refs/heads/branches/* > > > So when you do > > > git push hg-remote strings > > > It will automatically do the equivalent of: > > > git push hg-remote strings:branches/strings > > > Once you have configured git to automatically push to the right > > location, you can push all the branches with; > > > git push --all > > > You don't need to checkout a branch to push it. > git branch -a > > * default > remotes/hg-remote/branches/default > remotes/origin/HEAD -> origin/default > remotes/origin/copyright > remotes/origin/default > remotes/origin/documentation > remotes/origin/fontlockhang > remotes/origin/hairyblocks > remotes/origin/mac_init > remotes/origin/modernize > remotes/origin/shellcomplete > remotes/origin/strings > remotes/origin/usage1 > remotes/origin/wisent-parser You cannot push a branch you don't have. Obviously. But you can create the branches without checking them out, as I already explained: git for-each-ref --format='git switch %(refname:lstrip=3)' refs/remotes/origin Or you can push the commit of a remote branch: git push hg-remote remotes/origin/modernize:modernize It's not clear what would be the best thing to do here because you haven't explained your use-case. Normally people push their branches, that they have in the their repos. -- Felipe Contreras -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/CAMP44s1%3DmKS9xd69h8bzLcYoTzknM-xPP%3DxbnpqgXWPaUWwjcw%40mail.gmail.com.
[git-users] Re: [and remote branch tracking]
> On Sun, Apr 16, 2023 at 3:01 AM Uwe Brauer wrote: > git-remote-hg, and I wouldn't call it a "plugin", git doesn't have > plugins. It's just a tool. > I'm not sure what's going on here, as I don't have the code of > `mygit-push-named-branch`, but I suspect it's doing something like: > git push hg-remote strings:branches/strings > If that's the case I think I already explained to you that you don't > need to specify the refspec (strings:branches/strings), if the local > branches have the same name as the remote branches, so you should > probably name them like "branches/strings", not "strings". > Alternatively you can configure git to always push local git branches > to hg branches: > git config remote.hg-remote.push refs/heads/*:refs/heads/branches/* > So when you do > git push hg-remote strings > It will automatically do the equivalent of: > git push hg-remote strings:branches/strings > Once you have configured git to automatically push to the right > location, you can push all the branches with; > git push --all > You don't need to checkout a branch to push it. Well that this is not my case. I just tried that (after running git remote add hg-remote ../mercurial-matlab-emacs-default/ git config remote.hg-remote.push 'refs/heads/*:refs/heads/branches/*' git push hg-remote modernize error: src refspec modernize does not match any error: failed to push some refs to 'hg::/home/oub/Push-test/mercurial-matlab-emacs-default' git branch -a * default remotes/hg-remote/branches/default remotes/origin/HEAD -> origin/default remotes/origin/copyright remotes/origin/default remotes/origin/documentation remotes/origin/fontlockhang remotes/origin/hairyblocks remotes/origin/mac_init remotes/origin/modernize remotes/origin/shellcomplete remotes/origin/strings remotes/origin/usage1 remotes/origin/wisent-parser So it seems that in that case I need to checkout the branches, right? Indeed After git checkout modernize git push hg-remote modernize It worked -- 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/ -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/877cuby681.fsf%40mat.ucm.es. smime.p7s Description: S/MIME cryptographic signature
[git-users] Re: [and remote branch tracking]
On Sun, Apr 16, 2023 at 6:15 AM Uwe Brauer wrote: > > >>> "FC" == Felipe Contreras writes: > > > On Sun, Apr 16, 2023 at 3:01 AM Uwe Brauer wrote: > >> > >> > git for-each-ref --format='git switch %(refname:lstrip=3)' > >> > refs/remotes/origin > >> > > > git-remote-hg, and I wouldn't call it a "plugin", git doesn't have > > plugins. It's just a tool. > > > Ok. > > > >> I need to do a lot of pushes from git branch to mercurial named-branches > >> like > >> > >> git remote add hg-remote hg::../mercurial-matlab-emacs-default > >> git checkout strings > >> mygit-push-named-branch strings > > > I'm not sure what's going on here, as I don't have the code of > > `mygit-push-named-branch`, but I suspect it's doing something like: > > Sorry it is an alias. > > git push hg-remote strings:branches/strings > > Precisely. > > > > If that's the case I think I already explained to you that you don't > > need to specify the refspec (strings:branches/strings), if the local > > branches have the same name as the remote branches, so you should > > probably name them like "branches/strings", not "strings". > > > Alternatively you can configure git to always push local git branches > > to hg branches: > > > git config remote.hg-remote.push refs/heads/*:refs/heads/branches/* > > > Well that does not work it gives be the following error. > git: No match. At which time? When you do `git config`? Then it's probably your shell globbing git config remote.hg-remote.push 'refs/heads/*:refs/heads/branches/*' > > So when you do > > > git push hg-remote strings > > > It will automatically do the equivalent of: > > > git push hg-remote strings:branches/strings > > > Once you have configured git to automatically push to the right > > location, you can push all the branches with; > > > git push --all > > But what's about the correct order, I mean shall I push master first > then the others, or those which (approximately) were created first? It depends on your topology, "master" most definitely you should push first, but perhaps only the first time. If you have branches with commits in common, for example: master | *--*---* topic-a \ *-* topic-b Then you would need to push one before the other (the first time), in this case presumably topic-a, since topic-b branched off from topic-a. > Because I do remember in one mail you said the order which branch to > push first is somehow important, or I misunderstood you. Yes, if you are creating a new repository by pushing branches, it does matter the first time. Cheers. -- Felipe Contreras -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/CAMP44s3OWDEm4yaXbXu07GJ644ekwSZkUKGqXHXzRRG%3DQonmvw%40mail.gmail.com.
[git-users] Re: [and remote branch tracking]
>>> "FC" == Felipe Contreras writes: > On Sun, Apr 16, 2023 at 3:01 AM Uwe Brauer wrote: >> >> > git for-each-ref --format='git switch %(refname:lstrip=3)' >> > refs/remotes/origin >> > git-remote-hg, and I wouldn't call it a "plugin", git doesn't have > plugins. It's just a tool. Ok. >> I need to do a lot of pushes from git branch to mercurial named-branches >> like >> >> git remote add hg-remote hg::../mercurial-matlab-emacs-default >> git checkout strings >> mygit-push-named-branch strings > I'm not sure what's going on here, as I don't have the code of > `mygit-push-named-branch`, but I suspect it's doing something like: Sorry it is an alias. > git push hg-remote strings:branches/strings Precisely. > If that's the case I think I already explained to you that you don't > need to specify the refspec (strings:branches/strings), if the local > branches have the same name as the remote branches, so you should > probably name them like "branches/strings", not "strings". > Alternatively you can configure git to always push local git branches > to hg branches: > git config remote.hg-remote.push refs/heads/*:refs/heads/branches/* Well that does not work it gives be the following error. git: No match. git remote -v Gives hg-remote hg::/home/oub/tmp/change-master/mercurial-matlab-emacs-default (fetch) hg-remote hg::/home/oub/tmp/change-master/mercurial-matlab-emacs-default (push) origin g...@gitlab.com:kalthad/matlab-emacs-default.git (fetch) origin g...@gitlab.com:kalthad/matlab-emacs-default.git (push) > So when you do > git push hg-remote strings > It will automatically do the equivalent of: > git push hg-remote strings:branches/strings > Once you have configured git to automatically push to the right > location, you can push all the branches with; > git push --all But what's about the correct order, I mean shall I push master first then the others, or those which (approximately) were created first? Because I do remember in one mail you said the order which branch to push first is somehow important, or I misunderstood you. -- 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/ -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/87o7noxelw.fsf%40mat.ucm.es. smime.p7s Description: S/MIME cryptographic signature
[git-users] Re: [and remote branch tracking]
On Sun, Apr 16, 2023 at 3:01 AM Uwe Brauer wrote: > > > git for-each-ref --format='git switch %(refname:lstrip=3)' > > refs/remotes/origin > > Changing slightly the topic, when I am using your git-hg-remote plugin git-remote-hg, and I wouldn't call it a "plugin", git doesn't have plugins. It's just a tool. > I need to do a lot of pushes from git branch to mercurial named-branches > like > > git remote add hg-remote hg::../mercurial-matlab-emacs-default > git checkout strings > mygit-push-named-branch strings I'm not sure what's going on here, as I don't have the code of `mygit-push-named-branch`, but I suspect it's doing something like: git push hg-remote strings:branches/strings If that's the case I think I already explained to you that you don't need to specify the refspec (strings:branches/strings), if the local branches have the same name as the remote branches, so you should probably name them like "branches/strings", not "strings". Alternatively you can configure git to always push local git branches to hg branches: git config remote.hg-remote.push refs/heads/*:refs/heads/branches/* So when you do git push hg-remote strings It will automatically do the equivalent of: git push hg-remote strings:branches/strings Once you have configured git to automatically push to the right location, you can push all the branches with; git push --all > git checkout modernize You don't need to checkout a branch to push it. Cheers. -- Felipe Contreras -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/CAMP44s0cgvCDZAURG592JDWN6ccZqtB%3Dpgw2cS3cD6M_O3DZWA%40mail.gmail.com.
[git-users] Re: [and remote branch tracking]
> git for-each-ref --format='git switch %(refname:lstrip=3)' > refs/remotes/origin Changing slightly the topic, when I am using your git-hg-remote plugin I need to do a lot of pushes from git branch to mercurial named-branches like git remote add hg-remote hg::../mercurial-matlab-emacs-default git checkout strings mygit-push-named-branch strings git checkout modernize . . . etc So, could I wrap this in a similar loop you indicate above? -- 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/ -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/87mt38z255.fsf%40mat.ucm.es. smime.p7s Description: S/MIME cryptographic signature
[git-users] Re: [and remote branch tracking]
> On Sat, Apr 15, 2023 at 2:35 AM Uwe Brauer wrote: > Not all references are branches, but all the ones that are branches > are fetched, except in a different namespace: /refs/remotes. > Local branches are /refs/heads, and that's what `git branch` shows. > Remote branches are in /refs/remotes, and that's what `git branch > --remotes` shows. > But the remote branches are not always up-to-date, that's why they are > called "remote tracking branches", that is: they track remote > branches, but they aren't always necessarily the same. > This is OK, but you can create a branch and check it out at the same time > with: > git checkout -b feature origin/feature > Except, for new users `git switch` may be easier: > git switch -c feature origin/feature > A more recommended way is to "track" the original branch: > git switch -c feature -t origin/feature > To understand what this does you would need to learn about the concept > of "upstream tracking branch" [1], but you don't have to, just know > that it's generally better if you set it up. > You don't have to type that, because `git switch` can guess what you > want to do, so just: > git switch --guess feature Ok thanks that is useful, I will put in my HOWTO.org file, for the moment, otherwise to much information in a very short time. > `git checkout` is more appropriate here. > There are remote tracking branches, but they are not in the > /refs/remotes namespace, they are in the /refs/heads namespace, so > your local branches are remote tracking branches. > If you do changes on a "feature" branch, they will be overridden when > you do `git fetch`. Ok. > Once a mirror, always a mirror. > Yes, but I think you should forget about using a mirror, that's not > what you want. > I think what you want is to mirror all the remote branches only once, > and otherwise have a normal repository (not a mirror). > You can do that with this command: > git fetch origin refs/heads/*:refs/heads/* Thanks > This will create local branches for all the remote branches (the > remote refs/heads/foo will become a local refs/heads/foo). The problem > with this approach is that the local branches will not track the > remote branches. > At the end of the day I think what you should do is do `git switch` > for every remote branch, which git can help: > git for-each-ref --format='git switch %(refname:lstrip=3)' > refs/remotes/origin Definitely going in my HOWTO.org file thanks -- 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/ -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/87v8hwxpe7.fsf%40mat.ucm.es. smime.p7s Description: S/MIME cryptographic signature