Local branch, remote tracking branch and remote branches in git

I just put together a sim­ple visual model for the dif­fer­ent kinds of branches it git. You are likely to find this infor­ma­tion the most use­ful when you are deal­ing with git pull and git fetch.

enter image description here

As you can see, there are not just two but three kinds of branches in GIT.

1 : Local branches
This is what you get when you run the the git branch com­mand. You can also find them in the .git/refs/heads/ directory.

2 : Remote Track­ing branches
As implied by the name, these branches track remote branches. Some of your local branches also map directly to these branches. Think of these are a route through which data on the remote branches are accessed.

3 : Remote branches
These are branches that live on a remote machine( or in a dif­fer­ent direc­tory in the same machine in case you con­fig­ured one direc­tory to act as a cen­tral point). All your remotes are listed in the .git/refs/remotes/ direc­tory but you can also list them using the com­mand git remote -v which is much more con­ve­nient since it also shows you the url for each remote.


Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *