What is the Difference Between Git fetch and Git pull?

 Git fetch and Git pull are both two different command used by git users to different purpose with your repository. As you know Git is a version control software to track your file changes. It keeps your files changes safe in the repository.

There are many commands like git init, git commit, git status, git config, git branch, git checkout, git fetch, git pull, git merge, git add., and git reset etc. You can check more here.

Git fetch command

The command can use any time to update the remote branches and it will fetch the latest data from the original branches. This command will not make any changes in your local branch. It detect the changes are done in the remote repository or not. And you should run this command before making any git pull request on your local branches.

When you will hit the git fetch, it will collect the all commit that specific target branch and store them in your local repo. It will not merge with your current branches.

Git pull command

The command used to get any changes from the remote repository and download to your local repository. It will automatically merge and pull your commit into your local branches. It will not let you know about automatically merge while pulling request.

When you will hit the git pull command, it will fetch the data basically and also merge with any new changes. So, it will get the latest data with new changes from the remote repository.

Original post can find here.

 

 

Comments

Popular posts from this blog

WooCommerce Redirect to Checkout After Click on Add to Cart

Multiple Where Condition in Laravel Eloquent