Harsh Rawat Harsh Rawat - 1 month ago 5x
Git Question

Git Fetch/Merge Confusion

I am a newbie in Git and was going through various tutorials to understand it.

I have a remote 'Origin' which has two branches 'master' and 'development'. Now i made certain changes in development from GitHub and committed it.
Then i went to my local master branch using

git checkout master

and used

git fetch origin development:development

Now if i create a merge request using

git merge origin/development


git git merge origin/development development

then also both the branches are getting updated on my local.

I am not really sure here about what is happening. Any help is appreciated !

If downvoting then kindly let me know what could have been improved in the question.



When you do git merge origin/development while having master checked out, you merge the origin/development branch into your master branch. This is why changes you did on github's development branch have appeared in your local master

If you want to have changes from github's development to appear on your local development do

git fetch origin development
git checkout development
git merge origin/development


git fetch origin development:development
git checkout development