Repositories
Last modified Tuesday, 24-Sep-2024 11:58:58 UTC.
- A repository is a data structure that stores a set of files or directory structure, with
metadata that captures a historical record of changes in the repository.
Depending on whether the system in use is distributed like (Git or Mercurial) or centralized
like (Subversion, CVS, or Perforce), the whole set of information in the repository may be
duplicated on every user's system or may be maintained on a single server.
- The repository can be stored only locally, or also saved to a central server.
- A popular central service support within IntelliJ is GitHub.
- A local Git repository in IntelliJ
- Make sure git is installed. IntelliJ does this, but you can
read some details here.
- Enable the GitHub plugin in IntelliJ preferences.
- Create a project as usual, e.g., I have a project called "RepositoryDemo" containing
RepositoryDemo.java
- Use the VCS menu to enable git version control.
- Add files - right-click on file, Git->Add
- Commit files whenever you have finished a working session.
Used the check mark in the menu bar.
Add a message saying what you have done.
- Reverting to an old version
- Right-click on file, Git->Show history
- Look at diferences to see which you want
- Right-click on version, Get
- Commit
-
Here is another version of how to do that.
- Saving the repository to GitHub
- Create a (free)
GitHub account.
This might be for the rest of your computing life, so choose your name and login
thoughtfully.
- Create a personal access token following
these instructions, with the scopes repo, gist, read:org, workflow.
- Copy your token and save it somewhere safe
- Register the account in IntelliJ, in Preferences->Version control->GitHub, use
the '+' sign to add your account.
It will ask you to authorize IntelliJ in your GitHub account, using your access token.
- Share to GitHub in VCS->GitHub. Accept all defaults.
This will create a GitHub repository for you.
- Push with each commit.
- From this point never cry (or ask for mercy from me) if your computer dies ... all
your work is safely stored in GitHub!
- Working with others
- Add other GitHub users to your repository
- Pull (with merge) changes made by others
-
Here's how to import an existing project into IntelliJ.
Exercises
Exam Style Questions