Harshal Kshatriya
Harshal Kshatriya

Reputation: 5850

How to update only a particular file from one branch to the other using EGIT in eclipse?

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?

Upvotes: 1

Views: 1736

Answers (1)

Nevik Rehnel
Nevik Rehnel

Reputation: 51945

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).

Upvotes: 1

Related Questions