Git + IntelliJ setup

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
The other very rusty / unfamiliar piece for me, and probably a tad more important than blocks!

Back when I was still doing some dev a couple years ago it was all about Perforce and Eclipse/WSAD. I've gotten so used to the terms in P4 and "reading the matrix" on the insane revision graphs we have here (main app probably built up around two hundred branches...) that git is just different enough to throw me off when I think I've figured out what I'm supposed to do ;)

Since then I've just done command line and Notepad++. Trying to get set back up now!

For other newcomers to the project we'll get over time I'm thinking it might be nice to throw together a quick primer on how to pull the code from github (fork to own account? just grab code read-only and submit "pull" requests? What's the difference between pull and push, fetch and checkout, etc.) and how to best get setup in IntelliJ to start making some magic happen. For instance, don't allow IntelliJ to make a new project, as it'll overwrite the working project file in git and end up not working at all; and if nothing seems to happen when you ask IntelliJ nicely to check out via git make sure you've got the SSH setup step working first :)

At this point I'm theorizing that I do something like the following (yet haven't figured it out yet)

1) Fork the project on github - done
2) Check out the source via a new project in IntelliJ so the code will show up (first terminology quirk as check out in Perforce just makes a file you've already got from your active branch writable)
3) "Merge" later revisions from the remote parent branch (which apparently is not origin, as that is your personal fork...) into your project somehow
4) Submit the changes to your personal branch somehow?
5) Start actually working on something useful
6) ....
7) Profit?

I made a quick target page for related instructions - http://wiki.movingblocks.net/Blockmania/DevSetup
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Funny. I've disabled the Wiki on GitHub without migrating the GitHub workflow instructions. Insanely intelligent. :geek:
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Okay. I've migrated to old entries.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Cool, I thought there used to be an intro. Got time to elaborate on it a bit sometime and connect it to how to work in IntelliJ, or do you do all your git via command line instead of any of the version control setup inside IntelliJ? I was trying to get IntelliJ to behave, which proved tricky :)
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
I'm mostly using IntelliJ for committing and pulling/pushing. I'm doing the more tricky using the command line since I don't trust IDEs most of the time... And I sometimes even don't trust Git so... :laugh:
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Behold! For I have worked Git!

https://github.com/Cervator/Blockmania/ ... 9c810bb8ac

... yes, that's a typo fix in 8 locations across two files. Baby steps! It took me two entire evenings to figure that out... and I've got years of experience in source control using Perforce, including a major migration and quirky integrations that melt heads. Whoever came up with the naming convention for Git commands needs to be severely beat by nerf bats, preferably wielded by developers who are used to what things were called to begin with!

I understand the power of Git and think I had mostly everything figured out yesterday, but gah. Imma write up a Blockmania-specific guide for catching all the pitfalls...

Next up I've got something interesting in mind for the console. Yesterday a light bulb finally went off on what the true power behind something nifty is. Going to make sure it works the way I expect it to before saying more :D
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Bump! Finally updated the DevSetup page with a more verbose step-by-step guide

I set up everything on my wife's PC (Blinkie on GitHub) step by detailed step, trying to catch every little thing. Works great now, though the sound might again be a bit wonky. Going to have her take a bunch of screenshots for a gallery.

Still need to add a few bits on how to pull in changes from another branch as well as more details on how to commit/push/rebase/etc all those crazy terms

Tossed the page at Stuart, who's registered for both Wiki and Forum now (I set up proper access too), to test out and provide more feedback - also happy to take any suggestions / edits from elsewhere, I'm sure it can be refined :)

One note: I picked "beglablock" for the alias to the master branch instead of "upstream" - I know the latter term is technically accurate, but IMHO Git is confusing enough as it is with the "origin" reference tossed in already for your personal remote reference to GitHub. As a perfectly timed example somebody already forked the Blinkie repo rather than begla directly (huh) which might confuse what exactly upstream would be for that person?

I'm also not sure yet if we should be using pull requests or just fetch changes to push ourselves - wonder how they differ on the network / branch graph? I noticed my "develop" is still dead-ending after it got merged into the new Blueprint branch - maybe if I re-fetch from the blueprint branch and push to my develop it'll connect the dots on the map?
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Nice. Changing those irritating naming conventions of Git a bit is absolutely okay with me. Pull requests are quite nice because of the top-notch interface GitHub provides there.

Regarding your develop branch vs. the bluebrint branch... This could work, but I'm quite honestly not sure. I have never been in this exact situation. :D But since almost every mistake can be recovered using Git. Just try and error.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Hmm, this might take some tweaking and getting used to. Unless you did something differently when you merged stuff from my branch than just now when I merged stuff back into mine?

https://github.com/Cervator/Blockmania/ ... 5cfdaaf9b0

This time it did update the network graph in a sensible fashion. But the commits included are sort of funny, as they include my own commits from earlier - that doesn't seem right? The conflicts were benign since I hadn't modified the files, but after you merged stuff over, then updated a few of the affected files, they got flagged on my side as if we both independently added / removed files :unsure:

I added more details on exactly what I did: http://wiki.movingblocks.net/Blockmania ... ent_branch

To make it even goofier I submitted two tiny fixes then tried to wrap them in a Pull request back to BlueprintPrototype - and my same commits from earlier (plus the latest tiny two fixes) are listed again

Incidentally this is exactly what me and Stuart worked on back when we were at the same company - code integration quirks, heh :)

(Same problems, different tool!)

Edit: Oh, it gets worse. Hello.groovy was renamed, which screwed up, as I still have the file and it included in the Pull request: https://github.com/Cervator/Blockmania/ ... 494dc09a85

Pushed a delete of just that file and the Pull request updated with it automatically. Wonder how it'll deal with a re-add + re-delete in the same Pull.
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
I did the following: At first I checked out your branch using a remote tracking branch. Then I rebased this branch on develop (to get my latest changes in there). I also had to rebase again later, since I put out some minor modifications in the context of the main develop branch. But rebasing with public repositories is just evil and might have created those issues you described.

This might also have crated this issue here: https://github.com/begla/Blockmania/issues/50

The branch is working totally perfect on my side (even after completely deleting the project and checking it out again using git reset --hard HEAD. Who is this GooMan by the way? :D
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Nooo clue who GooMan is, not Stuart. Probably just another interested person :)

Yeah both branches compile and work great, it just seems goofy that Git/GitHub believes simultaneously that the changes from my branch have been merged and not merged, since they show up again for merging... :)

I'm still not totally on top of Git and especially rebasing, but will figure it out eventually!
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Looks like the Pull submit fixed up the branch graph! Cool :)

Will still have to tinker and think some more to add more advice for stuff like that to the DevSetup page
 
Top