When you clone an existing Git repository, or put an existing project under Git version control, IntelliJ IDEA automatically detects if Git is installed on your computer. If the IDE can't locate a Git executable, it suggests downloading it.
IntelliJ IDEA supports Git from the Windows Subsystem for Linux 2 (WSL2), which is available in Windows 10 version 2004.
To access your ProjectHut Git repositories, it is necessary to first install client software on your computer. Mac OS command line Git clients are the most powerful way to access your version control system, however are also the most complex and more difficult to learn. Mac OS GUI Git clients provide a more user-friendly interface to your repository, and are sufficient for many users, however. A fast and friendly git client for Mac and Windows. Fork is getting better and better day after day and we are happy to share our results with you. Download Fork for Mac. OS X 10.11+ $49.99, free evaluation. Download Fork for Windows. Work with repository. Create, clone or add existing repos. Open recent repository quickly. The 'clone' command downloads an existing Git repository to your local computer. As the makers of Tower, the best Git client for Mac and Windows, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.
If Git is not installed on Windows, IntelliJ IDEA searches for Git in WSL and uses it from there. Also, IntelliJ IDEA automatically switches to Git from WSL for projects that are opened when you use the wsl$ path.
If for some reason you need to manually configure IntelliJ IDEA to use Git from WSL, in the Settings/Preferences dialog Ctrl+Alt+S go to Version Control | Git, click the Browse icon in the Path to Git executable field and select Git from WSL via the
wsl$ path, for example, wsl$debianusrbingit .
Check out a project from a remote host (clone)
IntelliJ IDEA allows you to check out (in Git terms clone) an existing repository and create a new project based on the data you've downloaded.
Put an existing project under Git version control
You can create a local Git repository based on an existing project sources.
Associate the entire project with a single Git repository
Associate different directories within the project with different Git repositories
After you have initialized a Git repository for your project, you need to add project files to the repository.
Add files to the local repository
When Git integration is enabled in your project, IntelliJ IDEA suggests adding each newly created file under Git, even if it was added from outside IntelliJ IDEA. You can change this behavior in the Settings/Preferences dialog Ctrl+Alt+S under Version Control | Confirmation. If you want certain files to always remain unversioned, you can ignore them.
If you attempt to add a file that's on the .gitignore list, IntelliJ IDEA will suggest force adding it. Clicking Cancel in the confirmation dialog only cancels force adding ignored files - all other files will be added to the Git repository.
Exclude files from version control (ignore)
Sometimes you may need to leave certain files unversioned. These can be VCS administration files, artifacts of utilities, backup copies, and so on. You can ignore files through IntelliJ IDEA, and the IDE will not suggest adding them to Git and will highlight them as ignored.
You can only ignore unversioned files, that is files that you see in the Unversioned Files changelist. If a file is added to Git but not committed, you can right-click it in the Local Changes view and choose Rollback.
Git lets you list ignored file patterns in two kinds of configuration files:
Add files to .gitignore or .git/info/exclude
If you need to exclude files by a certain pattern, or files of a certain type, you can edit the
.gitignore or .git/info/exclude file directly. See .gitignore patterns format
If you want ignored files to be also displayed in the Local Changes view , click on the toolbar and select Show Ignored Files.
Check project status
IntelliJ IDEA allows you to check the status of your local working copy compared to the repository version of the project. It uses specific colors to let you see which files have been modified, which new files have been added to the VCS, and which files are not being tracked by Git.
Open the Local Changes view.
For more info on changelists, see Group changes into different changelists.
Track changes to a file in the editor
You can also track changes to a file as you modify it in the editor. All changes are highlighted with change markers that appear in the gutter next to the modified lines, and show the type of changes introduced since you last synchronized with the repository. When you commit changes to the repository, change markers disappear.
The changes you introduce to the text are color-coded:
You can customize the default colors for line statuses in the SettingsPreferences dialog Ctrl+Alt+S under Editor | Color Scheme | VCS.
When you delete a line, the following marker appears in the gutter: .
You can manage changes using a toolbar that appears when you hover the mouse cursor over a change marker and then click it. The toolbar is displayed together with a frame showing the previous contents of the modified line:
You can roll back changes by clicking and explore the differences between the current and the repository version of the current line by clicking .
Instead of reverting the whole file, you can copy any part of the contents of this popup and paste it into the editor.
Add a remote repository
To be able to collaborate on your Git project, you need to configure remote repositories that you fetch data from and push to when you need to share your work.
If you have cloned a remote Git repository, for example from GitHub, the remote is configured automatically and you do not have to specify it when you want to synchronize with it (in other words, when you perform a pull or a push operation). The default name Git gives to the remote you've cloned from is origin.
However, if you created a Git repository based on local sources, you need to add a remote repository for other contributors to be able to push their changes to it, and for you to be able to share the results of your work.
Define a remoteMac Where To Download Git Repository
In some cases, you also need to add a second remote repository. This may be useful, for example, if you have cloned a repository that you do not have write access to, and you are going to push changes to your own fork of the original project. Another common scenario is that you have cloned your own repository that is somebody else's project fork, and you need to synchronize with the original project and fetch changes from it.
Add a second remote
How To Clone A Repo Git
To edit a remote (for example, to change the name of the original project that you have cloned), select it in the Git Remotes dialog and click the Edit button on the toolbar, or press Enter.
To remove a repository that is no longer valid, select it in the Git Remotes dialog and click the Remove button on the toolbar, or press Alt+Delete.
You can also edit a remote from the Push Dialog by clicking its name.
![]()
Learn more from this video:
Last modified: 09 September 2020
During development of Node.JS, you may need to clone a GitHub reposity to local mac computer. A repository on GitHub is a remote repository. You can clone the repository to your mac computer in order to create a local copy and sync between the two locations.
1. Open the main page of the repository in browser. click Clone or download.
Git On Mac
2. Click the Copy icon to copy the clone URL for the repository.
3. Open Terminal on your mac. You can do this by openning Launchpad and search for Terminal. Once it’s opened, you can right-click the Terminal icon in dock and choose “Options > Keep in Dock” so that you can open it directly from dock next time.
Git Repo Tool
4. Type cd and the directory where you want the cloned directory to be made. You can right-click the folder in Finder and choose “Copy <the folder name>” to copy the path into clipboard. Then by pressing “Command” and “v” on your keyboard to paste the path into terminal.
5.Type “git clone”, and then paste the URL you copied in step 2. Press Enter. The local clone will be created.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |