How to create a REMOTE branch using smartgit?
Asked Answered
P

7

15

How to create a REMOTE branch using smartgit?

Pillowcase answered 16/8, 2010 at 13:1 Comment(0)
A
8

With the usual command-line Git, a remote reference is automagically created when you clone a remote repository with git clone href://... (which would call the remote 'origin' by default).

Or, you can add it manually with a command like git remote add origin href://.... To push up a branch, you would execute git push origin branchname. (See more detailed examples and explanation here.)

However, I can see that SmartGit is a little different (I have not used it myself), and is GUI-based. As far as I can see, the 'Clone' and 'Push' commands mentioned above can be found in SmartGit's 'Remote' menu. If you want to add a reference to a remote repository, is there an 'Add' option in the 'Remote' menu??

Anoxia answered 16/8, 2010 at 13:15 Comment(0)
H
12

The Push Advanced trick didn't work for me. The only way I can seem to do this on SmartGit 3.0.6 was:

  • Remote -> Manage Remotes, then click Add and put in the details of the remote e.g. 'master', 'https://github.com/SomeCompany/SomeRepo'.
  • Then click Pull. It will say that it can only update submodules blah blah, hit OK. The Fetch will output a warning "no common commits".
  • Now go to Branch -> Branch Manager. Right-click on your local branch and choose Set Tracked Branch... then choose the appropriate remote branch.
  • Fetch again. Properly this time.
  • Finally do your push to the remote.

It's quite an achievement for a GUI tool to make something less intuitive, but SmartGit does an amazing job of it here.

Order of events

Hayman answered 20/6, 2012 at 6:52 Comment(1)
I wanted to track a branch from another remote (that I previously added) and somehow it did NOT appear when I created a new branch (The option Check Out -> Create a local branch -> Track remote branch -> origin/master) I ended up creating a local branch which is not tracked and added tracking with your solution (go to Branch -> Branch Manager. Right-click on your local branch and choose Set Tracked Branch... ) ThanksGerick
A
8

With the usual command-line Git, a remote reference is automagically created when you clone a remote repository with git clone href://... (which would call the remote 'origin' by default).

Or, you can add it manually with a command like git remote add origin href://.... To push up a branch, you would execute git push origin branchname. (See more detailed examples and explanation here.)

However, I can see that SmartGit is a little different (I have not used it myself), and is GUI-based. As far as I can see, the 'Clone' and 'Push' commands mentioned above can be found in SmartGit's 'Remote' menu. If you want to add a reference to a remote repository, is there an 'Add' option in the 'Remote' menu??

Anoxia answered 16/8, 2010 at 13:15 Comment(0)
H
4

SmartGit does not make this very clear, but there is an easy way to accomplish this. First off, I'm assuming you know about branch tracking. A local branch will in general track a remote branch (probably on a server). This allows you to push and pull changes to and from that branch.

The trick is to reset the tracking branch so it is not tracking anything. To do this, go to Branch » Branch Manager, right click on your local branch, then click 'Reset Tracked Branch...'

Now when you are ready to push your changes as a new remote branch, go to Remote » Push Advanced and make sure that the 'Push current branch' radio is the only thing selected.

When you press the push button, it is going to ask you if you want to configure tracking. Press the skip button. You should now have a remote branch.

Note: Name your local branch what you want it to be named as a remote branch before you push it.

Heulandite answered 31/1, 2012 at 15:49 Comment(1)
Update: I just did this with SmartGit 4 (new). It works as above but the menu item under Remote is just 'Push' not 'Push Advanced'Calctufa
U
3

In SmartGit 4.5.2, it is really easy. Just go to Remote > Add and just type the URL of the remote

Undercarriage answered 14/5, 2013 at 14:20 Comment(0)
B
3

As of SmartGit 6.5.9 ( August 2015 ):

  • check out (double click) the branch, that your new one should be based on (most likely you already did that)
  • right-click (as described) in the Branches-Tab on the local branch, you want your new branch based on. Use the (o) Custom Ref. The field is disturbingly short, wrongly making me think, this might only be for short git hashes like 92fa03d or such, but indeed setting new branch names like feature/JIRA-1234-your-feature-here do work as expected:

    enter image description here

  • double-click the new remote branch in the Branches Tab (origin fold-open). SmartGit will as usual offer to create a properly named and tracked local branch

Bean answered 7/8, 2015 at 8:41 Comment(0)
J
2

The current SmartGit version (6.5.8) does this easily with a Push To command.

  • Push To is in a context menu in the Branches tab (not in a window level Branch menu).
  • The context menu is opened by right mouse clicking on the branch you want to push.
  • Just enter the name of the remote branch you want to create in the Push To dialog.

SmartGit will create the remote branch, push current branch HEAD to it, and set the remote branch as your tracking branch.

(All of this is assuming you want to create the branch in your standard origin tracking repo for the current local repo.)

Jackinthepulpit answered 23/5, 2015 at 0:34 Comment(0)
T
-1

I don't know that you can create a remote branch, but I think you might find what you're looking for under Project/Clone...

(Disclaimer, I've only used this once, and it was a while ago)

You could try asking on their forum/discussion list. They are very good at answering mail sent to support to (Help/Contact Support...)

Trubow answered 16/8, 2010 at 13:26 Comment(1)
Sorry, wrong. Projekt->Clone asks for a new workspace physicial file location (which is something one never does in git, no matter how many branches, tags, ...). So must be something else.Bean

© 2022 - 2024 — McMap. All rights reserved.