Daniel
Daniel

Reputation: 15413

not seeing all changes from merged branches

I worked on two different branches and when the work was completed I got them merged. This is using Bitbucket.

However, when I go to run git fetch origin release/4.0, I do not see the new code I used from one of the branches.

So there is a 2625 branch, which is PR # 490

and 2612 branch, which is PR # 491

Both were merged on Bitbucket, but when running git fetch origin release/4.0, I only see the merged changes of 2612.

Do I need to run a git pull for all those changes to take place inside of my local branch of release/4.0?

By the way release/4.0 is the equivalent of the master branch.

Upvotes: 0

Views: 38

Answers (2)

Ramana
Ramana

Reputation: 1935

git fetch just "downloads" the changes from the remote to your local repository. git pull downloads the changes and merges them into your current branch. In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.

Upvotes: 1

Christian Legge
Christian Legge

Reputation: 1035

git fetch does not change the contents of your working tree. See the documentation:

Fetch branches and/or tags (collectively, "refs") from one or more other repositories, along with the objects necessary to complete their histories. Remote-tracking branches are updated (see the description of below for ways to control this behavior).

All this command does is update your references to the remote. In order to get those changes into your working tree, you must either checkout the branch git checkout origin/<branch> or merge it git merge origin/<branch>.

git pull is effectively running a fetch and a merge on the branch you specify, and would accomplish the same thing.

Upvotes: 4

Related Questions