Member-only story
Tech Basics
Git Tricks
Git | GitHub | SCM
Objective
This post talks about few tips and tricks using Git in daily usage. Nothing new or fancy in this post, just a standard stuff which I found helpful in my day to day work. I made an assumption for this post that you are already have familiarity using Git. Some of content, I have taken from Internet search.
Git Pull and Fetch
When you clone someone’s repo to start work, you are making a copy of it. After that you may have to get the changes sometimes, which have been applied to the original source. The Pull
and Fetch
are your tools.
git fetch
is the command that tells your local git to retrieve the latest meta-data info from the origin. So it updates your remote-tracking branches under refs/remotes/<remote>/
. This operation is safe to run at any time as it never changes any of your local branches under refs/heads
.
git pull
is the command that tells your local git branch to retrieve the latest changes from the remote repository, while also updating your other remote-tracking branches.
In other tech words 😵
git fetch
fetches updates but does not merge them.