Pushing and Pulling
Pushing and pulling are the keys to collaboration. 🤝
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 such like with 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.
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 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 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.
Pulling and fetching take updates from the remote and get them into our local repo.
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 automatically fetches updates from your remote repositories every minute by default. You can change this setting from Preferences General menu.
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 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 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 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) 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.
Note: Remember the golden rule of rebasing, 'Never rebase while you're on a public branch', which is covered in our blog post.
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 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 different branch.
Right click on a branch to set the upstream or click the option.