I am using BitBucket for web based hosting of our projects. Along with that I am using their SourceTree for committing and such purpose. I am a bit confused with the Checkout, Fetch and Pull option available in the SourceTree interface and their usage. Can someone familiar with this tool explains the usage of these options available in SourceTree?
git fetch is the command that tells your local git to retrieve the latest meta-data info from the original (yet doesn't do any file transferring. It's more like just checking to see if there are any changes available). git pull on the other hand does that AND brings (copy) those changes from the remote repository.
If you're using Sourcetree, Bitbucket gives you a single button checkout. In the repository's Branches, click the branch you want to checkout. Press the Check out button to display the appropriate check out command. Copy the command (or choose Check out in Sourcetree if you'd rather use Sourcetree).
If someone on your team has made a change to your remote repository, you want to pull those changes locally. From your repository in SourceTree, click the Pull button. A popup appears to indicate that you are merging the file from Bitbucket to your local repository.
Using Atlassian's Git tutorial (link updated) as a reference.
Git checkout:
The git checkout command lets you navigate between the branches created by git branch. Checking out a branch updates the files in the working directory to match the version stored in that branch, and it tells Git to record all new commits on that branch. Think of it as a way to select which line of development you’re working on.
Source: https://www.atlassian.com/git/tutorials/using-branches#git-checkout
Git pull:
You can think of git pull as Git's version of svn update. It’s an easy way to synchronize your local repository with upstream changes. The following diagram explains each step of the pulling process.
Source: https://www.atlassian.com/git/tutorials/syncing#git-pull
Git fetch:
The git fetch command imports commits from a remote repository into your local repo. The resulting commits are stored as remote branches instead of the normal local branches that we’ve been working with. This gives you a chance to review changes before integrating them into your copy of the project.
Source: https://www.atlassian.com/git/tutorials/syncing#git-fetch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With