I have an empty git repository sitting here, and I'm trying to figure out how to get Intellij to start using it. I'm not that familiar with git, but traditionally, to initialize it from the command line, I'd just git clone it and git push it, but when I try to do something similar for Intellij, it doesn't seem to work.
The first thing I tried was to create a new empty project and then checkout from version control, but it won't let me do that because it requires that the directory not exist.
The second thing I tried was instead of creating a new project, to checkout from version control directly in the main page (I'm using Idea 14). Neither of these have worked, though I am quite new to this so I feel like I'm missing something quite obvious
Could someone point me in the right direction?
Thanks!
Related
There seems to be a problem adding newly created files to subversion through Intellij, because when I right click on any of them, the option to add them is grayed out and only Revert is accessible:
By the way, this problem only appears with newly added files, the old ones are detectable and can be edited and committed without problem.
Maybe I missed something when I created them?
Any help would be appreciated. Thank you.
The solution was really simple. Here's how I did, hopefully this will help someone else one day:
Leave Intellij (or the IDE you're using) aside and open your command prompt.
CD to the root of your project.
Manually add the files that you have created with the command add.
Example: svn add path/to/your/file.java
Go back to Intellij, you should see all your files which weren't detected before change color from yellow to green.
You can now commit your new files.
I'm a coding newbie, so this may be sort of a dumb question. I was working on an SQL project to learn the language and I wanted to know if there was a way to download and execute a Github repository, I haven't used Github before. Thanks!
If you are a newbie, I think you should learn how to use git.
You can refer the link below: https://education.github.com/git-cheat-sheet-education.pdf
Basic steps:
Clone or download source code from Github.
You can download it directly, or use a tool like Git-bash, tortoise git...
Run this source code, depending on the language of the source code.
In order to run any code in a Github repository, you will need to either download it or clone it to your machine. Click the green "clone or download repository" button on the top right of the repository. In order to clone, you will need to have git installed on your computer. Then, follow these instructions. You could also just click download. Once you have it on your machine, how you run the code will depend on what type of code your project is written in.
I'm assuming that you found a repository relating to SQL on Github that you want to run, the best thing to do is to scroll down and read about that repository I'm sure most of the time there are instructions there on how to install or run the repo and from there if you don't understand something try Googling that keyword I'm sure Google has an answer for that and also best way to learn.
If you use codesandbox you can import and export from it to github. So, when you go to codesandbox, the very left bar, click on the rocket (deployments) and deploy to Github (pages). But I'm sure there must be a way to also do it from github via github actions, but I couldn't figure out either
You cannot directly run the code because it only can run based on specific environments like using python. Instead of using git to clone the code, you could download the code zip file through the code button on the github project.
Step 1:
Open GitHub and navigate to the main page of the repository.
Step 2:
Under the repository name, click on Clone or download.
Step 3:
Select the Clone with HTTPs section and copy the clone URL for the repository. For the empty repository, you can copy the repository page URL from your browser.
Now just go to your Ide(editor) and open terminal just enter the below command, click to Enter.
command : git clone [url]
$example -> "git clone https://github.com/ImDwivedi1/Git-Example.git"
Now you can see folder has been created in your directory.
Smartgit has decided that my repository is somehow misssing from my hard drive.
The repo that is definitely not missing, its exactly where i left it, nothing has changed as far as i'm aware. The repository i've been using for six months and made over 100 pull requests from.
If i rightclick the repository in the Repositories panel, and select Settings, it brings up a file selection window, presumably expecting me to tell it where the repo is.
When i do so, by clicking Select Folder in the folder its already in, it seems to reject this and brings up the window again, infinitely. It will not accept me telling it that the repository is exactly where its always been and still is
https://i.imgur.com/VLjOSHu.gif
I have no idea what's going on here, please help
I had a very similar issue just now. I think the answer/clue is already there in your screen capture with SmartGit warning down the bottom right corner.
I ran git gc manually in command prompt and all went back to normal.
For me, the %userprofile%/.gitconfig was misconfigured. I discovered this when I tried to run git.exe init and it said there was an error on a line in that file.
I'm new to JavaFX 8 and the IntelliJ IDE. I have a JavaFX8 project that works but not as I would like. I'd like to try another approach but the substantial changes may not work. I don't want to loose code I have working.
To save code I have working, I've been creating a new project and then locally copying all the folders(.idea, out, src) and files except .iml, of the working project into the appropriate folders in the new project with the newly generated .iml.
This always seems to work but is it proper procedure?
I'm not on a team of developers and have yet to learn Git/GitHub.
Please advise. Thanks.
Maybe you should learn how to use a Version Control System like Git, then you can create a project repository and have different branches for things you want to try out. Keeping the working code in your master branch will prevent you loosing your working code. Also, when using a vcs you can always revert to versions of your code that have been working. The IntelliJ Idea IDE has perfect support for working with all different types of version control systems. If you don't want to learn any forms of vcs then there is no other way to "backup" your working code.
Is it proper procedure? It's probably not how most people would go about achieving what you want to achieve but it's certainly workable. If you wanted to stick with that for simplicity now, I'd copy the whole directory structure, delete the .idea and .iml files, and then create a new project in IntelliJ on that clean copy: IntelliJ will automatically set up folder structure based on the existing source without you having to go through any additional manual setup.
If you're willing to experiment with the git route, to achieve the basics of what you want to achieve is not very complicated and I've written a small quick-start below. IntelliJ offers very good support for Git, and once your repository is created you can do everything you need from the IDE. I'm going to assume you're working on Windows, although the steps shouldn't be too far removed on other platforms.
Install Git
You can download and install Git from https://git-scm.com/download/win, which will install a command shell called Git Bash.
One-off setup for your project
Open up git bash and go into the directory containing your source. Rather than seeing separate drives as Windows does, Git Bash assumes there is a logical 'root' directory under which all your files are accessible. Your C: drive will be /c. To move around you can use cd to change directory (using / instead of ) and ls to list files instead of using dir.
Assuming your source code is in C:\projects\myproject:
cd /c/projects/myproject
git init
The second line above creates a git repository in that directory. This doesn't affect your code, it just creates a folder called .git that contains all of the book-keeping information.
You don't want to have every file under version control - in particular you don't want your build outputs. You need to set up a file in your project directory called .gitignore which tells git which files and directories should be ignored. As a starting point you can copy https://github.com/github/gitignore/blob/master/Java.gitignore and rename the file to .gitignore
Basic Commands and committing your initial version
There are a small number of basic commands:
git status
Running git status will tell you which files have been modified, which are not under version control, and which files have been added to the staging area to be committed next time.
git add path/to/file
This adds a file to the staging area waiting to be committed. You can add multiple files to the staging area before committing them in one go.
git commit -m "description of your change"
This commits all of the staged files as a new version, which the specified commit message.
If you go into your project directory, do a git status and check through the list to make sure there's nothing you don't want to have under version control, then you can do git add . to add everything to the staging area and git commit -m "Check in initial version of the source code" to commit it to the repository.
After you've committed, you can run
git log
To see a history of all of the changes. IntelliJ has a view that will show you the same thing.
Creating an experimental branch
This is where git shines; if you want to try something experimental you can create a branch of your project while allowing git to preserve the original version.
git checkout -b experiment1
Will create and switch to a branch called experiment1. You can delete, rename, move, rewrite and develop whatever you like on this branch. The changes you commit will be independent of your original working version.
You can switch back to your original version (preserving all of the changes you've committed on that branch) using:
git checkout master
Where master is just the name of the default branch created when you ran git init. The experimental version will still be there and can be switched to again using git checkout experiment1 or from IntelliJ using the branch selection in the bottom right corner of the status bar.
If you decide that the changes you've made in experiment1 are to become your new "good" version, you can merge them back into the master branch and repeat the cycle from there.
I've been using GitHub for a while for source control on a singular developer project but now I am trying to set it up across multiple machines.
Everything seems to be pushed correctly but when I clone it to my other Mac and try to run it I have a ton of Redefinition errors. Ex) "Redefinition of enumerator", "Property has a previous declaration" and so on.
Has anyone had any experience with this issue and what I can do to fix it.
I used a simple git clone on the target machine to retrieve it.
It is an iOS project in objective c.
This probably has nothing to do with github. But it may be git.
It's possible that you did a 'git pull' and had a merge problem. If you run "git status", are some items red? If so, look in those files for lines with "<<<<<" and ">>>>>". Those lines are telling you about a merge conflict. You need to fix the conflict and delete those lines, then git add the file and then commit + push the file back to github.
Alternately, you can do git checkout <file> to throw away any changes. (and maybe git merge --abort)