Why do we use “git pull origin master”?
I am currently collaborating with a team that is working on a project using the Git module. One of our team men has recently pushed the changes to the main branch (master). Explain to me why it is used to git pull origin master and what is its impact on my local repository and the codebase.
The git pull origin master is mainly used in fetching the latest changes from the remote repository’s “master” branch and then merging them into the local repository’s current branch. Here is the breakdown given:-
Git pull:- This particular command usually combines two actions “git fetch” and “git merge”. In other words, it is used in fetching the changes from the specified remote repository and then merging the commit changes into the current local branch.
Origin:- This particular component is used to give the default name to the remote repository.
Master:- It refers to the branch from the remote repository which you want to pull changes from.
Here is the example given of using “git pull origin master” if a particular terminal:-
“git pull origin master”
If you implement this above command then it will fetch the changes from the “master” branch and named “origin” and then after it will merge them into your required current local branch.