Reputation: 4617
I generally do the git pull command to fetch+merge with my local repositor from remote repo
Does git pull fetches+merges all the branches from github repo or just do the operation specifically for the branch upon which the refs have been defined. ??
Suppose I have not defined the refs for a particular branch and if I call git pull on that, what does it do ?? I have tried to observe it many times but I do not have a complete understanding about it.
I have made a lot of changes to a particular file, now if I git pull on that branch. Will my changes just go away and get merged with the pulled file. ??
Upvotes: 1
Views: 437
Reputation: 8200
git pull
without parameters will work only if the branch you currently checked out is configured for parameterless pull, i.e. it is a tracking branch. You can see branches configured for parameterless pull and push by using git remote show remotename
in this case it will actually print out a text saying that you didn't specify the branch with which you expect git to work
If your changes are committed and not conflicting with whatever you have pulled from remote - they will be merged together. They will not go away. OTOH if you know or think that the the remote branch might have changes that your local branch doesn't have i would recommend to use git pull --rebase
. If your changes are not committed the operation will be aborted and you will have to commit those or stash
Upvotes: 1
Reputation: 51892
merge
the branch at which you run the pull
command. Other branches are fetched only.fetch
receives the latest information for all branches.stash
the changes or commit
them.Upvotes: 1