git pull from upstream code example

Example 1: update my fork repository at github

# Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:

git fetch upstream

# Make sure that you're on your master branch:

git checkout master

# Rewrite your master branch so that any commits of yours that
# aren't already in upstream/master are replayed on top of that
# other branch:

git rebase upstream/master

Example 2: git fetch upstream

These steps update the master branch.

1. Make sure you are on the appropriate branch.
	git checkout master

2. Fetch content from upstream
	git fetch upstream

3. Merge upstream with the appropriate local branch
	git merge upstream/master
    
4. Get help on Resolve merge conflicts if these occur.

5. If you also maintain a GitHub repository, push changes to 
	GitHub’s (origin) master branch
	git push origin master

Example 3: git update fork from original repo

$ git remote add upstream https://github.com/[Original Owner Username]/[Original Repository].git
$ git fetch upstream
$ git checkout master
$ git merge upstream/master
$ git push

Example 4: git fetch upstream from master

$ git rebase upstream/master

$ git checkout master

$ git fetch upstream