Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When pushing to remote Git repo using EGit in Eclipse, what should I choose?

Tags:

git

eclipse

egit

EGit pop-up window

What is the

HEAD
master [branch]

?

What should I choose for the "Source ref" and "Destination ref", respectively?

like image 773
qazwsx Avatar asked Apr 28 '12 17:04

qazwsx


People also ask

How do I connect to a remote Git repository in Eclipse?

Go to the "Git Repositories" view, open the tree of the repository you want, right-click on "Remotes" and select "Create Remote". Remote name is the alias, and the url is specified in the second step of the wizard. Brilliant. Thanks!

What is Eclipse EGit?

Eclipse EGit™ EGit is an Eclipse Team provider for the Git version control system. Git is a distributed SCM, which means every developer has a full copy of all history of every revision of the code, making queries against the history very fast and versatile.

How do I push a project from GitHub to Eclipse?

Step 1: Open Eclipse IDE and right-click on the project you want to push and go to Team->share project. Step 2: It will add the project to the given repository as shown below: Step 3: Again right-click on the project and go to Team->commit.

What is push ref specifications Eclipse?

Push Refspecs This means that the currently checked out branch (as signified by the HEAD Reference, see Git References) will be pushed into the master branch of the remote repository.


2 Answers

You see this screen in Egit Push URI documentation:

Push Ref Specification

That is where you define the refspecs:

A "refspec" is used by fetch and push operations to describe the mapping between remote Ref and local Ref.
Semantically they define how local branches or tags are mapped to branches or tags in a remote repository.
In native git they are combined with a colon in the format <src>:<dst>, preceded by an optional plus sign, + to denote forced update.
In EGit they can be displayed and also edited in tabular form in the Push Ref Specification and the Fetch Ref Specification and other dialogs.

The "left-hand" side of a RefSpec is called source and the "right-hand" side is called destination.
Depending on whether the RefSpec is used for fetch or for push, the semantics of source and destination differ:
For a Push RefSpec, the source denotes a Ref in the source Repository and the destination denotes a Ref in the target Repository.

Push Refspecs

A typical example for a Push RefSpec could be

HEAD:refs/heads/master

This means that the currently checked out branch (as signified by the HEAD Reference, see Git References) will be pushed into the master branch of the remote repository.

like image 54
VonC Avatar answered Oct 01 '22 08:10

VonC


I think you should probably check out a learning guide to understand the terminology of git. Maybe look at this site: http://gitready.com/

master is the default branch of the repo. Usually you consider this your "always working" production branch. Other work can be done in other branches and then merged into the master. "HEAD" is just the most recent changes regardless. In your case here, you would probably push to master (until you figure out branching).

In a nutshell, while you are learning git, stay on the master branch, and track the remote master branch, and push and pull from the master branch. You will soon discover a ton more amazing features of git as you go.

like image 37
jdi Avatar answered Oct 01 '22 06:10

jdi