How to Fetch Latest Update Form Bitbucket Private Repo to Local

If you are collaborating with a team and working on a fork of a repo. Merge conflicts are common on git but you always need to be upto date to avoid nasty merge conflicts, which may very well kill your production time if you get too far behind. This is how you can download the latest update to your repo.

Getting Updates to Your PC to Compare With Your Local Version

  1. Add a remote that is pointing to the original repo. Skip this step if you already done this.  Run git remote add <remove_name> <remote_url>
  2. Fetch the remote git fetch <remote_name>. This will download the source repo to your pc.
  3. Now that your source is downloaded you can compare it your local version with git diff <remote_name>/<branch_name>
  4. Once you have checked there is not merge conflict you can now merge it to master.

Special Cases:

Their might be time you want to do one of the followings:

Discard all local changes and set master (or any branch) just same as remote repo:

Run the following after you fetch.

git reset --hard <remote_name>/<branch_name>







2 responses to “How to Fetch Latest Update Form Bitbucket Private Repo to Local”

  1. Web Hosting Avatar

    The only problem I have with Bitbucket syncing is that it creates an unnecessary commit in the git history. You can bypass that however by fetching it to local and rebase it.

  2. Web Hosting Avatar

    Believe me we are creating apps based on Bitbucket API and people are using it. So please do it finally update and improve your API.

Leave a Reply

Your email address will not be published. Required fields are marked *