Understanding Git and how to use EGit (git eclipse plugin)
I just started working on a project that uses git as a repository. I've actually never used a version control system before as I'm a devloper team of one. From what I understand if you create a branch of a local repository, select that branch in elcipse & then make changes to the co开发者_开发问答de. You should then be able to select the original master branch & you wouldn't then see those changes provided you hadn't merged.
What's confusing me is that when I switch back to the master the changes I made in the new branch are in there...even though I haven't merged.
I'm obviously misunderstanding the whole thing....any ideaS'S Thanks.
I think a great resource for learning Git is Pro Git. It's a book, but you can read it online. The first chapters teach you the basics on Version Control and git basics.
Also, check this question, where some git tutorials are listed.
Even if you are looking for a quick start guide, I encourage you to take the time to read at least the first three chapters of Pro Git. This will give you a good general understanding of how to use a version control system, some git basics, and the power of branching and merging. Then check out the tutorials on the second link I posted.
Regarding egit, there's some documentation on its official site. Once you get the hand on git, it will be easier to learn how to use egit.
From what I understand if you create a branch of a local repository, select that branch in elcipse & then make changes to the code. You should then be able to select the original master branch & you wouldn't then see those changes provided you hadn't merged.
What's confusing me is that when I switch back to the master the changes I made in the new branch are in there...even though I haven't merged.
You didn't explicitly say this, but my guess is that you didn't commit those changes. Git will happily let you switch between branches with uncommitted changes - as long as those changes aren't in any files which differ between the two branches. The big thing that this helps with is when you're about to commit and discover you have the wrong branch checked out.
If you committed your changes, then switched branches, you'd see them disappear exactly as you expect.
(And merges, by the way, are commit-based operations - you merge two (generally) commits and create a new commit with both of the original two as parents. It makes no sense to think about merging with uncommitted changes.)
With respect to learning to use, and more importantly understanding Git, there are a lot of great references out there - for example the Git Parable (lighthearted introduction to the core ideas), ProGit and the Git Community Book. EGit is a great thing in principle, making things accessible through an IDE - but I'd caution you not to skip over a good understanding of how things are really working under the hood. It'll probably save you someday from clicking on a button then saying "oh no, what have I done!"
Regarding Egit, I would recommend ekke's corner articles:
"Blog series about my experiences to install and use a Distributed Version Control System integrated in Eclipse"
精彩评论