Git using (5) - in the IDEA

1. Git disposed in the IDEA

  Preface: IDEA tinker in Git is really hard, it was suggested by TortoiseGit.

  Open the IDEA Settings, the menu list on the left inside to find the Version Control Git.

  Git.exe Git only need to select the file in the installation directory "Path to Git executable" in the can, the other can keep the default.

  

  Click on the edge of the path "Test", pop-up boxes version information is configured successfully.

 

2. Create a local Git repository

  (1) work in IDEA interface, click the menu bar "VCS", select "Import into Version Control" into version control management tools. There are several options, namely:

    Create Git Repository: create a Git repository.

    Create Mercurial Repository: Create a Mercurial repository.

    Share Project on GitHub: the shared project on GitHub.

  

  (2) Select "Create Git Repository", create a local Git repository, select the location to create a local repository.

    Note: You need to create a local repository in the folder that contains the project, which is a directory in the project file to create a local repository will contain the entire project folder on.

  

  At this point IDEA detects create Git repository, and then asks you whether to import all the files to a local Git repository in the lower right corner of the working interface.

  

  The options are:

    View Files: File View, pop-up window select the file you want to add to Git.

    Always Add: always add, the project files are all added to the Git.

    Do not Ask Again: Do not ask again later modifications and additions will not be prompted whether to join the message box.

  Because there is no need to add to the project file in Git, it is proposed to be added manually select and add necessary to add to the ignore list.

  (3) created a local repository, there will be a line beginning at a line button Git workspace below the menu bar.

  

  Button functions are:

    Update Project: from a remote repository pull updates.

    Commit: submit updates to the local repository.

    Compare with the Same Repository Version: repository files before comparison.

    Show History: the revision of history.

    Revert: withdrawn, discard changes, use a local repository to overwrite the current workspace file.

 

3. Submit to a local Git repository

  After editing the file, click on the menu bar of Git Commit function key.

  

  Select the file to be submitted, fill out the log information, the following is a comparison of the update file, and finally click commit to submit to the local repository.

 

4. pushed to the remote repository

  After submitting to a local repository, if you need to use to develop, you need to push changes to a remote repository, GitHub here do take an example.

  Click on the work of the interface menu bar "VCS", select the "Push" under the "Git".

  

  In the pop-up window, click "Define remote", and then fill in the Git remote address in a new pop-up window, click OK, checks the case of a remote repository. After selecting the appropriate version, click Push.

  

  Warning may pop up, said local and remote repository is not a repository on the branch, the need for consolidation. The general election will be merged.

  note:

    If you are using SSH mode, you need to configure the private and public keys.

    If you are a new local repository and the old remote repository is not the same, then there will not push the issue.

  

  If you can not merge, you can replace the use of force, the local repository forced to replace the remote repository.

  git remote add origin URL地址
  git push --force --set-upstream origin master

  Then use IDEA enough.

  

 

5. From the remote to the local version of the library clones

  打开IDEA主界面,选择"Check out from Version Control"中的"Git"。

  

  输入远程版本库的URL,点Test验证远程版本库是否存在,选择要放置的目录,点击Clone。

  

  会提示是否根据版本库创建一个IDEA工程,点击Yes。

  

  根据需求创建一个项目即可。

Guess you like

Origin www.cnblogs.com/NyanKoSenSei/p/11604369.html