简体   繁体   中英

git and eclipse

I am totally lost on git, I read the docs but do not have a clue. I have been using CVS for decades and just need some help getting setup.

  • I have a linux machine I setup a git repository on (created a directory and ran git init). I have ssh access to the machine.
  • I have an eclipse java project that I would like to commit/push whatever to this git repository.
  • I installed egit in Eclipse, but it does not give me any options to setup a url or hostname:port etc.
  • Further it wants to make the repository where I have the project in the same directories. That cannot be right.

How do I get eclipse to commit this to the git repository on my linux machine?

I have no idea what people see in this program, I was never confused with CSV but now noone supports or allows CVS anymore.

You need to change your thinking. In particular, you say "Further it wants to make the repository where I have the project in the same directories. That cannot be right". But it is right. The repository is local. That is one of the fundamental differences from CVS. Make all of your changes in the local repository, and only push to a remote when you want to publish.

The design goals of a git are explained well in The git parable

It may help with the required paradigm shift moving from CVS.

git was developed for the purpose of controlling submissions to the Linux kernel so the design goal of supporting the version control a large distributed project was a key one.

You may consider local repository as a "smart" working directory. It is still possible to have centralized integration repository, similar to central repository in CVS with slightly different terms:

  • "check-in to repository" now is "push to integration repository"
  • "check-out from repository" now is "pull from integration repositoty"

Real magic begins after repository is cloned to the local computer. You get working directory and a lot of new opportunities.

  • Multiple developer branches in the same working directory. You may work with several features independently at the same time and switch easily between them. For example, I have branches for fixes of bugs (one branch per bug), and new features in the same repository (branch per feature). Switch is pair of commands/clicks
  • You can do frequent local commits of partially done work, and rollback quickly to any state of the repository. After feature is done or bug is fixed, you may "polish" history by combining and re-arranging commits before "push to integraton repository"
  • There are good opportunities to dig the project history, and this is really fast: all history is already on your computer
  • You can easily transfer changes from one branch to another. If for example, particular change is useful in several branches

Git is a distributed version control system (DVCS). This means you will have a repository on your local machine. You will need to read up on "pushing", "fetching" and "pulling". This is all under the idea of "remotes" - how you tell one repository where another one lives.

You can expect that there will be a .git folder in the root of your working directory.

I would do a quick read up on git at any of the following places:

gitready.com
progit.org/book
git-scm.com

There is also the #git channel on freenode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM