Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Origin and Upstream in Gitkraken

Tags:

git

gitkraken

I've been working on a Mac using Sourcetree to manage my repositories. I've recently found an Ubuntu machine to develop on, and having found that Sourcetree isn't available for Ubuntu, found Gitkraken as a potential alternative.

My question is, is there any way to set a different remote repository in Gitkraken for pushes and pulls? (E.g. push to origin/develop pull from upstream/develop using the buttons on the top menubar). And if that isn't possible, is there a way to track a different remote branch from the one you are pushing/pulling from?

For example Sourcetree is set up so that local/develop tracks the remote branch upstream/develop, while pushing to the remote branch origin/develop. So if people make changes to the original repository, it'll show up in my Sourcetree and I'll know to pull from upstream/develop to local/develop. And if I make any changes, I can push my fork at origin/develop and create a pull request there to merge to upstream/develop if the changes are approved.

Also, in in Gitkraken if I right click upstream/develop there is an option to merge upstream/develop into develop that should take the most recent changes in upstream/develop and merge it into my local copy right? (God help me if suddenly I'm merging my local develop to upstream).

like image 748
shstyoo Avatar asked Apr 26 '17 02:04

shstyoo


People also ask

How do I create an upstream branch in origin?

Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch. Simply use a git push origin command on subsequent pushes of the new branch to the remote repo.

What is origin and upstream?

upstream generally refers to the original repo that you have forked. (see also "Definition of “ downstream ” and “ upstream ”" for more on upstream term) origin is your fork: your own repo on GitHub, clone of the original repo of GitHub.

How do I change upstream?

Set upstream branch using the git push command with the -u extension or use the longer version --set-upstream . Replace <branch name> with your branch name. The test branch now has a set upstream branch.


2 Answers

I don't know how recently it is possible, but in version 6.0.0 of GitKraken, you can right-click on an origin and change push and pull paths independently.

screenshot

like image 187
Matthew Avatar answered Sep 23 '22 09:09

Matthew


My question is, is there any way to set a different remote repository in Gitkraken for pushes and pulls?

There is no such feature AFAIK. When right-clicking a branch, you can select to Set Upstream. This results in the message What remote/branch should "<branch>" push to an pull from?, which implies that a branch can only be set to push and pull from the same upstream via GitKraken.

[...] is there a way to track a different remote branch from the one you are pushing/pulling from?

I do not understand what you mean by "track" here, since a branch tracking an upstream means it is using it to pull from and/or push to. As per definition here in section Tracking Branches, upstream and tracking branch are used synonymous, so I guess the answer is no:

[...]what is called a “tracking branch” (or sometimes an “upstream branch”).

Concerning your last question, you can calm down:

[...]if I right click upstream/develop there is an option to merge upstream/develop into develop that should take the most recent changes in upstream/develop and merge it into my local copy right?

That's exactly what it does, just like a git merge upstream/develop when you have checked out your local develop.

like image 20
kowsky Avatar answered Sep 25 '22 09:09

kowsky