GIT Seriously messed up my site!

======== TEMPLATE BUG FORM ========

Wappler Version : 2.2.6
Operating System : Windows 7

This morning I created a GIT repository in Wappler so my changes would be safe.

Expected behavior

What do you think should happen?

I should be able to revert to previous versions and they should be the same as when I saved them there.

Actual behavior

They are all a mess. Somehow the parts of the files have gotten rearranged with everything being moved under a model. When I try to rearrange the parts back into the right order it’s a mess. It looks like it’s inserted my GIT comment into the code.

There’s also 1 javascript error that when clicked just spews out an endless string of characters

I don’t have time now to try to reproduce the error as I need to re-do my entire morning now. :frowning:
as every commit is messed up the same. Fortunately it seems to just be the files I was working on today, not the whole site but I’ll update if I find more issues.

I managed to get it fixed up by deleting all the inserted code. Took a little while but wasn’t quite as tragic as I first thought. Very strange though.

Anyway - I’m not too keen on using GIT now, does anyone have a reliable alternative to recommend?
Thanks,
Heather

AFAIK GIT doesn’t insert code. I don’t know what happened to your website but it’s not GIT.

For alternatives you have Mercurial, SVN, CVS…

Had same issue a few months ago. Fortunately it wasnt a critical site (was actually the webinars tutorial site) and the live site was up to date. I simply deleted the local site and downloaded the live site to repair it.

Not saying it doesn’t happen of course. Just saying that GIT doesn’t insert code by itself. Changing to a GIT alternative might seem to “fix” the issue because you are moving version control management out of Wappler. But moving GIT management out of wappler would also “fix” the issue.

Could it be that Wappler’s implementation of GIT adds this random code under a very specific scenario?

Good to know! I thought I had taken a crazy pill! LOL!

Yeah - I figure it’s something in the Wappler implementation of GIT. Hadn’t really thought about using GIT outside of Wappler so will still consider that as an alternative. Thanks.

Your code did have a conflict because GIT could not decide how to merge the code, GIT inserts the code from both versions into the file for you to solve. We currently don’t have a way to simply resolve them, you need to edit the code directly. GIT alternatives have the same problem, there it is also possible that you have merge conflicts. We plan to add more functionality for GIT, like having a way to resolve these conflicts by letting you choose which code version to use. You can also use a external GIT tool which already offers conflict solving.

More info about conflicts:

https://githowto.com/resolving_conflicts

But under no circumstances should GIT be inserting random code into files!! It wasn’t just my code messed up. It had inserted random code and also text from my GIT comments throughout. And this was on my first commit, right through every version so there was no “merge” to begin with.

When you do a revert or change from branch then it will merge the code from the previous commit or other branch with the current working (local) version. A conflict often happens if you made changes in you local files and you merge without first committing you local changes or discarding them. The code added by Git looks like:

<<<<<<< HEAD
    <link type="text/css" rel="stylesheet" media="all" href="style.css" />
=======
    <!-- no style -->
>>>>>>> master

Well - if it’s that easy to completely mess up code like that it’s not a great tool. I guess I probably did do something that caused the issue, but if merging without first committing local changes or discarding them often causes conflicts perhaps that shouldn’t be allowed by the system?? I mean, it defeats most of the purpose of saving versions if you run the risk of messing up your code entirely if you forget to commit changes. And I still don’t understand how that messed up the initial commit.

Damn. Didn’t account for merge conflict situations.
Perks of being a solo developer :slight_smile: