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?

  • git bug or misuse of branching?
  • Why does git say I am 40 commits ahead when I seem up to date and a push-pull (no files) fixes it?
  • Creating a branch with TortoiseSVN without /trunk structure
  • Git pull a certain branch from GitHub
  • Best way to maintain a Git fork
  • How do I use Git's interactive rebase with a local-only repository (no remote / origin)?
  • Can I orphan an existing branch?
  • git visual diff between branches
  • Mercurial: keep default branch “active”
  • Show just the current branch in Git
  • Merging two branches into one another
  • How to work with git
  • One Solution collect form web for “How to update only a particular file from one branch to the other using EGIT in eclipse?”

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

    Git Baby is a git and github fan, let's start git clone.