I have noticed that for whatever reason, new developers love to use
git pull for merging code. To get latest from another branch, they will do something like this:
- Switch to the other branch
git pullthe latest code for that branch
- Switch back to the working branch
- Merge the freshly pulled code into the working branch
git pull can get the job done. And developers will go months or years unaware of the much more nimble
The problem is that the steps above require us to switch branches, a slow git operation, two times. We can achieve the same outcome without switching branches by using
git fetch origin develop git merge origin/develop
And we have the latest from /develop into our current working branch.
The seemingly small efficiency gained from a workflow that uses
git fetch instead of
git pull will result in hours of saved time over the course of a project.
For more context I recommend this discussion about 'git fetch' vs 'git-pull'