Project Development: Play your Local Repo with Remote

Wednesday, October 17, 2012

Play your Local Repo with Remote

This article is typically a note-like one.

Facing the situation that Linux is the only system platform of three (Windows, Mac, Linux) which doesn't have a github client, then I have to play with command, especially my Egit for Eclipse doesn't work very well for remote operations.

Then comes the following command to help me push my commits to the remote repo, or fetch the remote to my local git.

1st, Before you start any push or pull operations, you need to create a new stream that assigns the original repo to a remote, which here is called "upstream"
git remote add upstream https://github.com/antonio081014/KeyChains.git

2nd, Fetch

git fetch upstream
# Fetches any new changes from the original repo

# Here original repo is the remote one.

3rd, Merge

git merge upstream/master
# Merges any changes fetched into your working files


4th, Push

git push upstream master
# this push new updated files to the remote
# before you push, you need to add those files and commit it.

The detail Git Cheat is Here.

Updated: a new found article could be found here, which explains everything I did above, while it adds plenty details. You could give it a check.