Git - Remote branch

Git - Remote branch

About

A remote branch is a branch in a remote repository. (remote reference).

Type

Management

List

git branch -r -l '<remote>/<pattern>'

git branch --remotes
# or
git remote show [remote]

Example:

git remote show origin
* remote origin
  Fetch URL: https://github.com/apache/spark.git
  Push  URL: https://github.com/apache/spark.git
  HEAD branch: master
  Remote branches:
    branch-0.5      tracked
    branch-0.6      tracked
    branch-0.7      tracked
    branch-0.8      tracked
    branch-0.9      tracked
    branch-1.0      tracked
    branch-1.0-jdbc tracked
    branch-1.1      tracked
    branch-1.2      tracked
    branch-1.3      tracked
    branch-1.4      tracked
    branch-1.5      tracked
    branch-1.6      tracked
    branch-2.0      tracked
    branch-2.1      tracked
    branch-2.2      tracked
    branch-2.3      tracked
    master          tracked
  Local branches configured for 'git pull':
    branch-2.3 merges with remote branch-2.3
    master     merges with remote master
  Local refs configured for 'git push':
    branch-2.3 pushes to branch-2.3 (up to date)
    master     pushes to master     (up to date)

where:

Delete

git push --delete <remote> <branchname>

Prune

git remote prune

Pull

To get the commit from a remote branch, you do a pull (ie a git fetch followed by git merge FETCH_HEAD)

Fetch (Sync information locally)

A fetch will get new branch information locally (ie branch created on the remote)

Example:

git fetch
From https://github.com/name/repoName
 * [new branch]      dev        -> origin/dev

To get the data in the local branch, you need to merge and if you want to do all in one move, you can just use pull





Discover More
Git - Fetch (Remote Repository Sync)

A fetch will sync information locally from a remote repository. It will mostly git fetch: download new remote branch download all commits added since the last fetch to the actual branch ( The head...
Git - Merge

Merge is a git merge tool that is designed to integrate changes from one branch into another branch It joins two or more branch together (ie development histories) The pull command is a wrapper that...
Git - Push

push will send branch to the remote creating remote branch Git automatically expands the branchName out to refs/heads/branchName:refs/heads/branchName, which means: Take my branchName local branch...
Git - Remote (Tracked Repository)

A remote in Git is a remote repository (ie a remote git server). Git remote manage the set of repositories (“remotes”) whose branches you track. They are also called tracked repositories in reference...
Git - Remote reference

Remote references are references (pointers name) located in your remote repositories. ie remote branches, remote tags, and so on. You can get a full list of remote references explicitly...
Commit History Master
Git - Remote-tracking branch

Remote-tracking branches are local references to the state of remote branches You can't modify them. They’re just local references that you can’t move. They represent the state of the remote repository...
Git - Tracking Branch

Tracking branches are local branches that have set their upstream branch. tracking branchreference The local branches have then a direct relationship with their upstream branch that can be: a remote...
Git - Upstream Branch (Tracking branch)

An upstream is a configuration of a local branch that set the remote branch that it's tracking. cloning @{u} or @{upstream} means the upstream branch of the current branch @{upstream} or @{u}...
Branches Git
Git - Branch

This page talks Branch management in Git. For Git, a branch is: a commit name (ref) that points to the last commit (head) leaf in the commit log (or log) that represents a commit chain Example...



Share this page:
Follow us:
Task Runner