Search code examples
gitversion-controlbitbucketgit-guiremote-branch

Different remote name GIT, fetch using GUI


At work we have a problem using GIT GUI for bitbucket.

I have a project on Bitbucket named TestProject, a remote named bitbucket for local repo, so when I push to remote I have a remote branch called remotes/bitbucket/master.

My coworker has a remote in GIT GUI named origin when he pushes the master branch he pushes on remotes/origin/master

When I do a fetch, I get the new commit correctly but my local branch master does not "follow" the commits of my coworker and I have to reset master branch to the last commit.

Viewing the project in bitbucket, I can see only the master branch without distinction between origin and bitbucket.

Can I solve it without change the remote name in my GIT configuration or do I have to delete the remote and add a new one with the name origin???


Solution

  • It’s unnecessary for you to re-configure. origin and bitbucket is just short name for the remote repo, and it has no effect for your local git repo works. If you want your local master branch “follow” your coworker’s, you should use pull instead of fetch.

    Fetch is only get the new changes in your local repo (.git/refs/remotes).

    Pull get the new changes in your working directly. So we also call pull=fetch+merge.