Multiple Git Branches in Multiple Eclipse Projects

We’re in the process of converting from Subversion to Git and one thing that I’m struggling with in Git is the method of switching branches.

My understanding is that at both at the command line and using EGit in Eclipse that switching to a different branch replaces the contents of the Eclipse workspace folder with that of the desired branch. This implies only one branch can be open at any one time.

  • How to set tracking on an existing repo to a remote repo with ngit (or jgit)?
  • If we delete a branch on the server, can we automatically delete it in our local copy?
  • git: Find the oldest commit of `mine` which does not exist in `theirs`
  • create a git repo for project skeleton
  • how to create git branch in remote repository without checking out using jgit
  • Code review of a branch in GitHub
  • In SVN I could arrange my Eclipse workspace similar to:

    Workspace/
       Project1Branch/
       Project2Branch/
       Project3/
       Project4Branch/
    

    Is it possible to have multiple Git branches open at the same time in the same Eclipse/Egit workspace ( or any other environment for that matter )?

  • Wikis with VCS backends?
  • Nodegit Remote Push with --force
  • Using git over sshfs is too slow
  • Where can I find an updatesite zip for eGit on Eclipse 3.6 behind a firewall?
  • git svn importing a branch with a trailing space
  • Colorize files in SublimeText tree-view based on git status?
  • 3 Solutions collect form web for “Multiple Git Branches in Multiple Eclipse Projects”

    After much testing and a sanity check from @MarkLeightonFisher it seems it is not possible to have multiple Git branches open in the same Eclipse workspace at the same time.

    Indeed you can’t import multiple branches from the same git repository into the workspace, because it only has one working directory which can contain only one checked branch.
    Here’s a very reasonable workaround that accommodates this feature of git (I do it and it works well):
    Clone the git repository in a second directory (or 3rd or 4th even), then change the name of the project manually by editing .project and changing the <name> element.
    You can now import this project alongside the original, and work on multiple branches at the same time in the same workspace.
    Caveat: Get very friendly with the “Close Project” menu item so you can avoid cross-editing (it gets confusing sometimes when you have many source windows open with the same file name…)

    Actually i managed to do it :

    You can have multiple workspaces for one git repository : this is called “worktree”. (limitation is that for obvious reason, you can’t checkout same local branch in 2 different work trees. Well, you shouldn’t, but some commands may lead you to be in such situation.)

    https://git-scm.com/docs/git-worktree

    Then you can create one eclipse-workspace for each of your work-tree.

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