Showing posts with label github. Show all posts
Showing posts with label github. Show all posts

Sunday, September 29, 2013

using github + eclipse to pull code

eGit doesn't know, which remote branch you want to pull from. If you create your local branch based on a remote tracking branch, then the key is generated automatically. Otherwise you have to create it yourself:
branch.master.merge=refs/heads/master
branch.master.remote=origin
where master stands for the branchname, in the key it's your local branch, in the value it's the branch in the remote repository. Place that in the repository-specific configuration file%repositorypath%\.git\config
As for the terms:
  • merge: join two or more development histories together
  • fetch: download objects and refs from another repository
  • pull: fetch from and merge with another repository or local branch
  • sync: allows you to compare 2 branches
In general, I urge you to read eGit user guide, where you can get even better understanding of Git and eGit. It can be found at http://wiki.eclipse.org/EGit/User_Guide

Wednesday, September 18, 2013

What is the difference between origin and upstream in github

This should be understood in the context of GitHub forks (when you clone a GitHub repo at GitHub, before cloning that fork locally)
From the GitHub page:
When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from.
To keep track of the original repo, you need to add another remote named upstream
git remote add upstream git://github.com/user/repo.git
You will use upstream to fetch from the original repo (in order to keep your local copy in sync with the project you wanted to contributed to).
You will use origin to pull and push since you can contribute to your own repo.
You will contribute back to the upstream repo by making a pull request.
fork and upstream

Git fork is git clone?

Fork, in the GitHub context, doesn't extend Git.
It only allows clone on the server side.
When you are cloning a GitHub repo on your local workstation, you cannot contribute back to the upstream repo unless you are explicitly declared as "contributor".
So that clone (to your local workstation) isn't a "fork". It is just a clone.
The other solution to contribute to that GitHub project is to:
  • clone that GitHub repo on your GitHub account (that is the "fork" part, a clone on the server side)
  • contribute commits to that GitHub repo (it is in your own GitHub account, so you have every right to push to it)
  • signal any interesting contribution back to the original GitHub repo (that is the "pull request" part)
If yo want to keep a link with the original repo (also called upstream), you need to add a remote referring that original repo.
See "What is the difference between origin and upstream in github"
fork and upstream