Git pull

git pull is used to fetch/download new content from a remote repository and immediately update the local repository with that content. git pull is a combination of git fetch  and git merge. In the first step of operation git pull will execute a git fetch scoped to the local branch that HEAD is pointed at. Once the content is downloaded, git pull will enter a merge workflow. A new merge commit will be-created and HEAD updated to point at the new commit.

// update local branch with new commits from the remote repo.
git pull

// update local branch with new commits from the remote. New commits from remote will be applied under new changes on local. 
// In other words, your local changes will be on top of the new commits from remote.
git pull --rebase

 

git fetch vs git pull

git fetch is a safe option whereas, git pull is a unsafe option. git fetch will download the remote content but not alter the state of the local repository.  git pull will download remote content and immediately appy the remote changes to local state of the local repository. 

 

 




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

Your email address will not be published.