I have started working with Git recently. Normally I use eclipse Egit and very rarely git shell. After going through a lot of material on Git and its branching, I still have confusion regarding that.
I know there are n number questions on Stack Overflow on the same topic but so far I have only either added to my confusion or I have got half baked knowledge on branching. So I am putting the n + 1st question on this regarding my understanding.
Can somebody confirm if my understanding is correct:
- There are two types of branches: Local and Remote where local branches are branches on local repositories and Remote branches are on Remote Repositories
- There is third type of branch called Remote Tracking branch which automatically adjusts its head to match with the branch its tracking whenever we fetch the changes from remote branch.
- So a branch can only track some remote branch and not any local branch. Is this correct?
- When I clone a remote repository two types of branches are created automatically as follows:
- Local branch called as master.
- A Local Remote tracking branch which tracks the remote repository's master branch.
- Can my local master branch (mentioned in 4.1 above) track Remote tracking branch created on local (mentioned in 4.2)?
- If yes I guess it is automatically set to track this branch and thats why I don't have to do anything special to fetch /push the changes to remote repository from my working directory right? So when I fetch the changes using Eclipse's Team synchronizing following things happen
- Changes in Remote Branch come in Local Remote tracking branch (4.2)
- As my local master branch (4.1) is set to track Remote tracking brnach (4.2),they come in my local master branch (4.1).
- And from my master branch they come in working directory right?
- and the same happens in reverse when i try to push the changes Correct?