Reputation: 3172
I am expanding on work done by another developer, and was given their existing code base over sneakernet. I started working on my local machine before the Git repository for the project was set up. Now, after getting access to the repository, I've cloned the repository to my local machine, set up my feature branch, added my changes to that directory, and have pushed my changes to the origin.
However, when I switched back to IntelliJ IDEA to continue working, it doesn't recognize that the project is now using Git. Where I would normally expect to see my branch name, it just says "N/A". How do I get IntelliJ to recognize that my project is a Git project now?
Upvotes: 1
Views: 3507
Reputation: 11
If IntelliJ is in safe mode, version control is disabled.
Trust the project and version control will show up.
Upvotes: 1
Reputation: 7680
What worked for me is changing manually the vcs.xml file from the .idea folder.
Should be something like :
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
Upvotes: 3
Reputation: 3172
The problem
There are a few problems here that created the issue:
The previous developer wasn't using IntelliJ IDEA, so there was no existing settings directory telling the IDE about the VCS setup
The original project directory wasn't used, but was instead copied from, and the pulled directory became the new project root
The original project directory wasn't under VCS, so IntelliJ didn't know to even look for the branch name
The fix
In the toolbar menu, select VCS > Enable Version Control Integration
, and in the popup window, select Git
. Now all of the Git features you would expect to see are working.
Upvotes: 3