Everyone
I don't know if the question has already been asked, but I'm looking everywhere but I can't find it.
I am working on a project on Intellij IDEA using GitHub.
I use my desktop computer at work to develop. After finishing I make a commit on Github and it is directly on my account.
But, sometimes I would like to continue at home on my laptop, using the same project as well as modifying and committing it.
Not knowing much about Github in integration with Intellij, I know that I can take an existing project and thus download it locally on my computer. But my question is, how can I update the changed files on each computer.
Example, I work at the office, I modified the A and B file, I commit it to Github, and at home on my computer, I update the Github project on Intellij and suddenly I have the new files modified.
If you have a solution, thank you!
I think you should need to take a "deeper" look into git fundamentals, here's a quick tutorial I think would do for your case:
Learn the Basics of Git in Under 10 Minutes
Also (if u can, and have the time) I would suggest you learn to use the git CLI before the IntelliJIDEA integrated plugin, so that, in case of problems, you know where to look under the hood.
To put it in easy words the most straight-forward thing you can do is (assuming you have already set-up a repo and a branch to work on):
(on the device you just worked on)
git commit -am "comment your wip here"
git push
(on the device where you want to get the work updated)
git pull
Related
I got a new computer yesterday. I am coding in Android Studio for a course that I'm taking, and I figured it would be as easy as re-downloading Android Studio and cloning my repo onto the new computer. It isn't.
Something is messed up about my Gradle version, and I don't have the time to figure it out before the next due date.
The solution I've potentially come up with is, because my program is relatively small at the moment (only a couple files beyond the boiler-plate files that come with any Android activity), to just copy and paste the Java code from each of my files into a newly generated empty activity with all the right Gradle versions, and then just push that to the repository.
My question is: is that possible to do? If so, is it as easy as just pushing the new project (without having ever cloned the repository), or is it more complicated? If possible, elaboration on an answer would be greatly appreciated.
Thank you!
It's very straightforward to do it:
Clone the desired original project
Add your desired code on top of the clone
Add & commit your changed
Now you can push your changes in several ways:
You can have a new commit
git push origin <branch name>
You can overwrite the current commit on your remote
git push -f the -f will force to "overwrite" the existing code
Yes, you can.
You just have to link your new local project to the git repository,
once you push the new changes they will erase the old ones.
I want to work remotely on my project but my project files are on the other machine in my office. I don't want to use Desktop Sharing because it uses a lot of traffic and it is slow. I want to work with my LOCAL intellij but files would serve from my computer in office. Is there any approach?
I don't think it will work, IntelliJ is built around the idea that the files are on the local drive, and if its a descent project it still will be slow.
Depending on your security settings, internet speed, etc.
You can try the following:
At work create a network drive that stores the code and on your local computer map this drive, so intelliJ will "think" that its a regular File System but in fact the files will be stored remotely. I personally believe that it will be really slow, but you can try, this is the closest answer to your question I believe.
Use X Server and stream the graphics from the intelliJ that runs on your server at work to your local PC. In such a setup the computer at work will run the intelliJ process and all the files will be stored there too. Your Local PC will show the graphics. Usually this works when you have linux at work, I do this sometimes with programs like MobaXTerm, probably there are others
Connect to you computer with remote desktop on Windows - as you say its slow but its still a solution, probably faster internet can solve the issue :)
By far the best option I can recommend: Use git's distributed nature. Assuming your project is managed by git (and if it isn't - consider using source control anyway).
Then checkout the copy of the project from... Here are two options:
Option a: ...from the remote central repository that hosts the source files of your project in your organization
Option b: ... from your computer at work, you can define in git the "remote source" (this question is not about git, I know but you can use (git remote add <your computer at work> + chose the protocol that will work for you best: ssh, git internal protocol, http, etc)
Then you'll compile the project locally (you might have to install build tools like maven, gradle, etc. on your local computer and then by using your locally installed IDE you will be able to develop fast. Now when you're ready to "submit" your code - you can push it upstream. In the option A it will be the remote repo like you probably already do at work, with option B you will push to remote branch on your computer at work.
This will be pretty fast and I used to work like this a lot of times.
I am pretty new to GitLab because we just moved to it from ClearCase. I Cannot merge some changes into my remote then to my local repo because the GitHub Desktop says that there are some conflicts. I have been looking around to find a simple solution for this in order to view the conflicting file. I got quite a few changes in my local too so I don't want to play around too much with the unfamiliar Git commands because I don't want to loose any of my changes. Is there simple way to find out which file is causing the conflict. I used git status and it says that my local branch is up to date.
I am a little lost. Can someone give me some hints.
Thanks
If i understood correctly then
Is there simple way to find out which file is causing the conflict?
Then try this command git ls-files -u will give a list of conflicts from Git.
Also you want to save your local changes then use git stash if you don’t want to do a commit of half-done work and you can get back to this point later by using git stash apply
I'm using Android Studio 2.1, which is based on IntelliJ IDEA 2016.
If you select VCS -> Commit changes there's a nice dialog showing all the modified files and you are able to choose what to commit.
However when selecting VCS -> Update project there's no dialog. You have to update everything give or take.
I really miss eclipse's Team Syncronize perspective. It kicked ass compared to this, both for commiting and updating.
Is there a way of displaying a dialog to select which files to update? Or maybe some plugin? I'm getting tired of importing workspace metadata from other team members, or even broken builds when doing bulk updates. The only workaround seems to be looking at the incoming tab first, and then right click over the files you want, which is not very efficient as you have to expand their packages or parent folder first, and you might also need to manually refresh the incoming tab.
Yes that's a nice question but unforunately we have no ways First thing first to checkout documentation of IntelliJ IDEA 2016.1 Help given here but not in depth. As vcs-> update will update all files from remote branch and it will never provide you options because it is not implemented yet !!
Also see comments discussion on this answer they have talked about whole issue you have here the question asked little matching with yours is this which is the same having this discussion.
This is unlikely to be an issue with the Android tooling and more likely an issue with the underlying intellij idea software.
This is already discuss over here in google code issues :
https://code.google.com/p/android/issues/detail?id=184086
I have already tried to search plugin or help software but coudn't find one. :(
You just can add a .gitignore file for metadata.
Although, when you update your project it's a good practise to commit files before (and choose only those files you want to update).
Regards!
I tried to reimport my android project on eclipse to solve a problem but I accidently overwrote all my files in the project. All of them had been corrupted which means their size is now 0B...
I tried to use Local History but it's useless since my project is no longer in my workspace, same for .metadata.
I also tried to use Recuva (Software for recovering files) which see my files with their real size but when I try recover them, their size is always 0B...
I lost about 7 days of work and I don't really want to rewrite my code using Java Decompiler...
So my question is, is there any solution to recover that files ?
I wrote 200 lines of code and suddenly system restarted. I lost all code. But I recovered data from eclipse's local history. Right click on the file -->replace with-->previous from Local History
Eclipse has a local history, although by default it's set very low - one of my first tasks when setting up a new development machine is to up the values (in addition to my other version control)
If you do have a history you can right click on your class, and select compare with local history.
You could try decompiling with something like JD-GUI. It might not be as onerous as you think. Obfuscators exist for a reason.
It is not really programming question, but i had similar situation and "Mini Tool Power Data Recovery" tool helped me (it is paid tool, free version exists, but maybe you can search in this direction and find something open source). I tried some another tools then, but with no results.