1

I've an updated file Constants.java in branch A. Now I need to switch to branch B. I need only the updated Constants.java file in branch B. How do I achieve this using EGIT in eclipse?

Harshal Kshatriya
  • 5,630
  • 11
  • 44
  • 60
  • possible duplicate of [Eclipse git checkout (aka, revert)](http://stackoverflow.com/questions/1750997/eclipse-git-checkout-aka-revert) – Greg Bacon Dec 22 '12 at 21:56

1 Answers1

1

To do this in git, you go about it like this:

  1. Checkout branch a: git checkout A
  2. Checkout file from branch b: git checkout B -- Constants.java
  3. Commit your changes: git commit

In EGit, the option to check out a single file is quite hidden: it can be found in the "Replace with -> Commit..." context menu of the file. (source from this answer).

Community
  • 1
  • 1
Nevik Rehnel
  • 49,633
  • 6
  • 60
  • 50