Pushing and pulling are the keys to collaboration. 🤝
Adding Remotes
To add a new remote, click the icon when hovering over Remote in the left panel, then fill in the remote URL.
When using an integration like GitHub or Bitbucket, select the remotes from your collaborators in the dropdown box. This makes viewing other forks of the same repository quick and easy.
Note: When using an integration, the drop-down box will only display Forks of this repository. If you would like to add a remote that is not a fork you can still do so via the URL option.
You can identify remote branches in the graph through the following icons:
- — GitHub
- — Bitbucket
- — GitLab
- — Azure DevOps
- — Other Remote Server
All remote branches are located in the left panel.
Push
Pushing takes any local changes , and making them available on the remote .
Push the currently checked out branch by clicking Push in the main toolbar, or by right clicking on the branch, and selecting Push.
Pushing attempts to upload any new commits to the remote branch, then fast-forward the remote to bring it up to date with the local repo.
If the remote branch cannot be fast-forwarded, the push will be refused. If this is the case, GitKraken Desktop will provide the option to Pull (fast-forward if possible), or .
Caution: Forcing a push is considered destructive because it overwrites the remote branch by replacing it with the local branch.
If the branch pushed does not exist on the remote, GitKraken Desktop will prompt you to name and create the new remote branch. This is typically the fork name followed by a slash, and the branch name. i.e. origin/my-branch
.
Drag and drop to push
Drag and drop a branch to a remote to access the Push action. You may drag a branch to a remote branch on the graph, or to a remote branch listed in the left panel.
Fetching
Pulling and fetching take updates from the remote and get them into our local repo. You can fetch by selecting the Pull dropdown. Additionally, you can select the radio button next to the desired option to change the behavior of this button.
Fetch All
Fetching gets updates from remote branches, but does not update any files in your working directory.
Updates will appear in the graph, and also update any branches on the left to show how many commits you are ahead or behind.
When you’re behind the remote, it means that there are commits on the remote branch which have not been incorporated into the local repo. Pull (fast-forward if possible) to get these changes on local.
If you are ahead of the remote branch, there are local commits that have not yet been pushed to the remote.
It is possible to be both ahead of and behind a remote. However if you are both ahead and behind a remote, you will not be able to perform a Pull (fast-forward if possible) as the branches have diverged. Consider rebasing onto the remote first.
GitKraken Desktop automatically fetches updates from your remote repositories every minute by default. You can change this setting from Preferences > General menu.
Fast-forwarding
Fast forwarding moves the currently checked out commit to one that was added later, replaying all commits in between in the order which they happened.
To fast-forward your currently checked out commit, you can right click on the branch with newer commits, and select the Fast-Forward option from the menu.
Pulling
Pulling first performs a fetch and then incorporates any commits in the remote repository into the local copy.
There are three pulling options. Let’s demonstrate what each one does by starting with an example 2 commits made locally, and 2 that have been made on the remote.
Pull (fast-forward if possible)
Pull (fast-forward if possible) fetches any updates on the remote branch, then attempts to fast-forward the local branch. If a fast-forward is not possible, a merge will be performed.
This is the default option for new GitKraken Desktop users.
Pull (fast-forward only)
Pull (fast-forward only) fetches any updates and then attempts a fast-forward. If a fast-forward is not possible, GitKraken Desktop will not make any changes to the local repo.
In our 2-commit example, a fast-forward is not possible as there are new commits added to both branches.
Pull (rebase)
Pull (rebase) stashes all commits on this branch, pulls in new commits from the remote, and then replays your commits. This has the added benefit of maintaining all commits in a single line, as opposed to creating branches which are then merged back together.
Setting a default pull option
Set the default pull option by clicking the down arrow to the right, and clicking on the circle button by each option.
Our interface page covers this and more.
Setting the upstream branch
Whenever pushing, pulling, or fetching, GitKraken Desktop gets updates from the Upstream branch.
The Upstream defaults to the remote branch where the local branch was checked out, but you may change the Upstream to push, pull, or fetch from a different branch.
Right click on a branch to set the upstream or click the option.
Alternatively, drag and drop a branch to push instead of setting upstream.