Hints welcome: how do you use git?

Hey Folks,

always, when we make a merge over two branches, we have serious issues with git. Whenever a developer worked on a file, which another Dev also edited, which is very common, we have struggles.

This are our common issues:
01 if two devs working on the same file and we merge the changes together, then the app often chrashes while loading the merged project.
02 If someone creates a new object such as a new class and the new class-file ist merged into the master, sometime the “{projectname}.xojo_project” is’t updated, so the IDE doesn’t load the new class. If the “.xojo_project” file is updated with the new class-object, then sometime the app doesn’t load either and crashes with a fatal error.

I think a lot of the issues are because of the specific structure of xojo projects. Most of the issues can only be solved by merging the different codebases manually.

Can someone tell us about their multi-developer-processes using git?!

this would be awesome :-*

We never have two developers working on the same branch. Each developer “owns” his own branch or hands it off to another developer. When we add a feature that requires multiple developers, we set up one feature-master branch, then branch off of that. Each developer merges their changes to and from that feature-master at appropriate times as they go and deal with any conflicts by first merging the feature-master into their own branch, then back again. I use Kaleidoscope on the Mac to deal with conflicts.

With certain conflicts, too much code is left in so it turns out like this:

if test then
  statement1
else
  statement2
else
  statement3
end if

We guard against that in the merge or catch it with compiler errors, but it’s rare.

When both developers have added classes, we might get duplicate lines in the manifest as items are shifted around. All we can do is guard against that too. But I don’t recall a time when new classes were left out of the manifest.

HTH.

It sounds that there are also some manual works you have todo, right @Kem Tekinay ?

1.) Are you trying to load the ‘merging’ state of the branch in Xojo? git will show you the un-merged files, where you can load them up in a text editor (we use sublime), search for “>>>>>” and “<<<<<” and “=====” , then resolve the conflicts manually for each affected file. Only then you should load up Xojo.

2.) Ensure your project is closed before merging. We only get conflicts in the xojo_project when both commits has added a new class each, which you can use step 1 to manually merge the file (just ensure all classes have their reference in the .xojo_project from your branch state and the merge, this occurs at the bottom of the .xojo_project)

once all conflicts have been resolved, load up the project, ensure no classes are missing (Xojo prompts), ensure it compiles, then add the merged files with git and commit the merge.

If there are conflicts, sure, which is why a good diff app is essential.

Like ArBed! I use a lot of different tools for a lot of different languages, but for Xojo, ArBed beats them all because it understands Xojo.

Also, if you have a Kindle reader, the GIT book is free - Pro GIT

Just like to add a piece of advice similar to this: if you’re using GitHub Desktop, close it while working on your project. It very often keeps files open/locked, and the IDE does not check for this when writing its files. I’ve had it happen many times where my changes weren’t written to disk because I had GitHub Desktop open. I’ve learned to only have it open as long as necessary.

I really wish the IDE would detect that it was unable to write some files during save.

What you should really be wishing for is GitHub Desktop to not be an Electron dumpster fire. It should not keep files open like that, but who cares about doing software right these days? I occasionally leave Versions.app open accidentally and have zero issues because, Mac! I haven’t left Fork open like that yet, but I would suspect it doesn’t cause the issue either.

I fully recommend Fork as a Git client. I intend to purchase it whenever it finalizes, provided it’s not SaaS for no reason.

SourceTree doesn’t have an issue with that either.

[quote=397210:@Tim Parnell]What you should really be wishing for is GitHub Desktop to not be an Electron dumpster fire. It should not keep files open like that, but who cares about doing software right these days? I occasionally leave Versions.app open accidentally and have zero issues because, Mac! I haven’t left Fork open like that yet, but I would suspect it doesn’t cause the issue either.

I fully recommend Fork as a Git client. I intend to purchase it whenever it finalizes, provided it’s not SaaS for no reason.[/quote]
The new version is. Version 224, the final “legacy” version, is not an Electron app. The choice of tool really has nothing to do with it keeping files open.

I hadn’t heard of Fork though. Looks nice, I’m going to give it a shot. I like GitHub Desktop because it integrates nicely with GitHub (duh) and packs a respectable number of features into a clean UI. And it’s free. It’s not perfect, especially now that it isn’t developed anymore, but it’s been my tool of choice since switching to Git.

Fork integrates with Github! :smiley:

I’ve been using Tower for the last few years. They just switched to SaaS, but I still find nd it to be a solid solution.

https://www.git-tower.com/mac

SmartGit works well for me, as GUI to git
https://www.syntevo.com/smartgit/

Syntevo:

[quote]Non-Commercial Licenses
SmartGit can be used free of charge by Open Source developers, teachers and their students, or for hobby, non-paid usage. We are also supporting certain non-profit organizations like public welfare or charities. If in doubt, please contact sales.[/quote]

No matter which language or toolset you use you will always have manual work to do when you have to merge branches etc., once you are working on any major project with multiple developers. It is just a fact of life.

I’m surprised nobody mentioned SourceTree. I use it daily with Mercurial but it does work with Git.

https://www.sourcetreeapp.com/

Look up. :slight_smile:

Oops.

My team’s GUI of choice is Tower, but I also use SourceTree and (mainly) the command-line.

Our best practices with git and Xojo involve not having two developers working on the same class at the same time. The Xojo IDE tends to keep things in alphabetical order, which means that as soon as you refactor something its position might move in the file, not to mention some of the artifacts that keep getting added like random indentation or TabStops.

But keeping it one developer, one file (in essence treating it like a binary file) is the best we came up with.

Project-level conflicts are rarer since that file is typically just a list of other files, so if you have a conflict it’s easy to fix it or re-do the work (adding or removing classes) manually.

I’ll use this one soon. Many people prefers it over SourceTree.

https://www.gitkraken.com/

https://www.youtube.com/watch?v=Lb4yvfrX_7I&list=PLe6EXFvnTV7-_41SpakZoTIYCgX4aMTdU