2

Very confused regarding Intellij terminology related to Git branches type. What are the differences between Git, Local and Remote branches?

Here is documentation that refer to those 3 types.

chenop
  • 4,743
  • 4
  • 41
  • 65
  • Or, although it has a different title, http://stackoverflow.com/q/10588291/1256452 (git-branching-master-vs-origin-master-vs-remotes-origin-master) – torek Oct 10 '16 at 07:44

1 Answers1

2

The documentation you cited describes how to checkout (create) a new Git branch from either a local or a remote branch. I count two things, not three. To make things more confusing, both the local and remote branches are actually local. For the sake of explanation, let's say the branch in question were called someBranch, and it had a local and remote version.

The local branch someBranch is what you would work on when doing your actual development in IntelliJ. For all intents and purposes, this is the branch someBranch.

The remote branch is actually a tracking branch. The remote tracking branch of someBranch would likely be called origin/someBranch by default, or something like that. The remote tracking branch exists primarily to sync up with the remote respository. When you do a git fetch, the remote tracking branch is actually what gets updated. So origin/someBranch would receive all the latest updates from the remote, but the local branch someBranch would not be updated. If you were then to create a branch from the remote branch, you would be using the latest version on the remote repository, and not whatever version you have locally. And there are many scenarios when you would want to do this.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360