How to create a REMOTE branch using smartgit?
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??
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.
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??
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.
In SmartGit 4.5.2, it is really easy. Just go to Remote > Add and just type the URL of the remote
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 likefeature/JIRA-1234-your-feature-here
do work as expected: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
The current SmartGit version (6.5.8) does this easily with a Push To
command.
Push To
is in a context menu in theBranches
tab (not in a window levelBranch
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.)
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...
)
© 2022 - 2024 — McMap. All rights reserved.