I'm not sure what this Git printout is telling me regarding my local branch/remote repository tracking. How can I read this?
I have 2 local branches:
When I type the command git remote show origin
, I understand the printout completely. When I type the command git remote show caelt
, I don't quite understand the information it is giving me. I've put those printouts below.
git remote show origin
* remote origin
Fetch URL: https://github.com/.../UnityCSharpConceptExperiments.git
Push URL: https://github.com/.../UnityCSharpConceptExperiments.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (fast-forwardable)
git remote show caelt
* remote caelt
Fetch URL: https://github.com/CAELT/SimulationAnimation.git
Push URL: https://github.com/CAELT/SimulationAnimation.git
HEAD branch: master
Remote branches:
master new (next fetch will store in remotes/caelt)
melmaster tracked
Local branch configured for 'git pull':
melmaster merges with remote melmaster
Local refs configured for 'git push':
master pushes to master (fast-forwardable)
melmaster pushes to melmaster (up to date)
Are the lines,
`Remote branches:
master new (next fetch will store in remotes/caelt)`
saying that there is a remote branch in the 'caelt' repository that is named 'master'? Is this different from my local branch, which is called 'master?'
Why is it saying that the next fetch will store in remotes/caelt? Isn't fetch the same thing as pull? And in that case wouldn't I be pulling FROM 'remotes/caelt' and storing IN local branch 'melmaster'? NOT storing IN 'remotes/caelt?'
Regarding the lines,
Local refs configured for 'git push':
master pushes to master (fast-forwardable)
melmaster pushes to melmaster (up to date)
Is this saying that my local branch 'master' is pushing to repository branch 'caelt'/master' or repository branch 'origin/master'? I want local branch 'master' to push to repository 'origin' in the origin/master. I do NOT want local branch 'master' to push to repository 'caelt' in a caelt/master (if indeed there is a branch called master in the caelt repository). How can I tell which master this is referring to?
In each printout, is the line
HEAD branch: master
referring to the branch in my local drive that I've set up as HEAD? Or is it referring to the branch in the remote repository that has been set up in the remote repository as HEAD?
Question 1.
Yes.
Remote branches are always kept different from local branches. By default, remote branches are in your local repository named remotename/branchname
.
For example, if remote "caelt" has a branch "master", this will stored in your local repository as branch "caelt/master".
Question 2.
git pull
is just a combination of git fetch
and git merge
. So if you pull, first a standard git fetch
is executed. Afterwards, if your current local branch is "master" and branch master is configured to have upstream "caelt/master", a git merge caelt/master
is executed.
Question 3.
Simply execute git config -l | grep branch.master
and look at what you are getting.