In the simplest terms, git pull does a git fetch followed by a git merge.

You can do a git fetch at any time to update your remote-tracking branches under refs/remotes/<remote>/. This operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy. I have even heard of people running git fetch periodically in a cron job in the background (although I wouldn’t recommend doing this).

A git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.

When is it recommended to use git rebase vs. git merge?
Do I still need to merge after a successful rebase?

Answer:Short Version

Merge takes all the changes in one branch and merge them into another branch in one commit.

Rebase says I want the point at which I branched to move to a new starting point

So when do you use either one?

Merge

Let’s say you have created a branch for the purpose of developing a single feature. When you want to bring those changes back to master, you probably want merge (you don’t care about maintaining all of the interim commits).

Rebase
A second scenario would be if you started doing some development and then another developer made an unrelated change. You probably want to pull and then rebase to base your changes from the current version from the repo.

This article focuses on how to simply and efficiently converse with Envato’s API in order to verify authors’ customers’ purchase codes in the author’s own applications. I talk through all the steps to setting up this function, covering how to create the unique API key required, using the PHP cURL function and interpreting the output.

It’s rather easy but you have to ensure that your site is based on some master repo that can be merged down the stream with earlier versions (repo that has all Magento versions as tags or branches that can be merged to latest from first). So here’s two scenarios to follow

1. My site is not in git

start by cloning from master repo that has all magento versions (at least to the version you are currently using)

get your clone and checkout new branch with the version you are currently using

copy over your current site to this version

after that done “git status” will show you the diff with original version you started with and all the edits you have made to it

its now smart to move all core edits to local codepool and revert any changes in core to original files, move any edts in default or base templates to your own template and revert changes in default or base template files. Same goes with all the files that look modified against the original version. This gives you “all my changes are separate from original code and they will not conflict my upgrades”, it’s wise to commit this state

If all things are separated from original files then it’s time to upgrade. Turn on default theme, disable all local and community extensions , merge the new version with your current branch. Visit the site to perform the upgrade

Now your site is upgraded and you can turn on your theme and custom extensions one by one to see what is compatible and what not. Debug and solve one by one

My site is already in git

if it is based on repo that has all versions you are in good condition (skip 2)

if it’s not then you can add some repo that has it all as your remote and start with merging your current version and separating changes from original like described in first scenario

make a new branch of your current site used

merge with new version

disable all local, community extensions, turn on default theme, and upgrade

enable theme, extensions one by one and debug where conflicts happen

It’s common to have a git setup like follows:

MAGENTO MASTER -> REMOTE ORIGN THAT HAS ALL MAGENTO VERSIONS

YOUR MASTER -> REMOTE ORIGIN IS MAGENTO MASTER

branch: yoursite_dev

branch: yoursite_stage

branch: yoursite_live

You always develop on your_dev branch andif changes are ready for evaluation you merge _stage with _dev and if changes are approved you merge the state to _live either from _dev or from _stage.