Reputation: 585
As will soon become clear, I'm not a master of Git or even Gitkraken. As such, I just have a hotfix, a master and a feature branch. I make changes in hotfix, commit, push, and merge into master (which I then also push). So far I've endeavored not to get more complicated than this.
Even my one feature branch is a bit cowardly, in that that I still keep my feature work separate (in separate files/directories) from my working files, and consistently merge master into the feature branch so I don't lose all the site's hotfixes – all so that my crucial site files are kept whole and untouched regardless of branch. I consider this an intermediate practice as I continue to maintain the site while getting my head around Git. Since now I'm having this bizarre issue, I can see why I hadn't taken that leap yet. Apparently I'm indeed not ready to power-use Git or Gitkraken.
This morning, I did some work on hotfix, and merged it into master. No issue. Then I tried to switch to the feature branch (which I hadn't been in for weeks as it has been all about hot fixes lately), and all hell broke loose. Gitkraken throws the error: "Checkout failed. Could not remove [swf file - one that was there long before my last commit] Operation not permitted." What? Web searches with these key phrases turned up literally nothing... making me the first person to have this happen, I guess.
Then!... immediately, still in hotfix and having done nothing further, suddenly there are 27 file changes staged and ready to commit! All of them deleted files, and none of which did I actually throw away. Some of them I didn't even touch since my last commit, others were new files I had made.
I was able to simply undo-button my way back and restore those deleted files, but this did inexplicable things to the Gitkraken timeline (see https://postimg.cc/ppw9zFNn) that I have no way of understanding... somehow it involves changes having been made to the feature branch (aka JQMUpdates5 in the screen cap) that I was unable to switch to...?
At least I got those deleted files back. However, I'm unable to move forward or to restore my repo to a workable state. Even after restoring to this morning's state via Time Machine, and attempting to retry the process, I get the same result.
The only thing I can think of is that the file GK "could not remove" is locked in the Finder. This shouldn't be an issue since this file is the same as many others like it in the repo – all of which are also locked n the Finder.
Other than that, it occurs to me I did not push master before trying to switch to feature – like I usually do. But as far as my meager understanding goes, it shouldn't be necessary to update the remote master branch before switching to a different local branch...
I need help. Is this a bug? Is my repo corrupted? The upshot seems to be that although I personally didn't delete any files, GK seems to randomly be doing it for me when I try (unsuccessfully) to switch to the JQMUpdates5 (feature) branch.
I'm trying to understand why my hotfix branch was in a fully up-to-date state until trying to switch to the feature branch, when suddenly GK trashes dozens of files and stages these deletions in one fell swoop. Undoing isn't helpful – just complicates the issue – and now I'm so spun around I have no clue how to get my repo back. It would be an absolute disaster for me to lose JQMUpdates5 branch, as it contains a huge amount of dev work.
I'm not sure how helpful my description of the problem is (because this is confusing as anything I've encountered), but I'd sure appreciate some guidance if anyone has any insight.
Upvotes: 3
Views: 2918
Reputation: 585
Okay, unbelievably, I tracked this problem back to a permissions issue on my local machine. For some reason my admin account on my Mac laptop had some issues with these ancient swf files being locked, and simultaneously permissions differed on these files than on the containing home folder (the latter had full permissions, whereas the former had basically none).
Because of this, Gitkraken was choking on these files when switching branches (and thus trying to delete said locked and permission-less files).
Now... why exactly this equaled Gitkraken then deleting a bunch of other, unrelated files, and immediately staging this change without my input – that's another matter. Happily, I don't have to grapple with that right now, since I restored the local repo from a backup, recursively re-granted myself permission to do with these problem files as I wish, then force pushed all this to the remote repo (which I'd managed to muck up with some pushes I perhaps should not have made, in retrospect). Now I'm back to full operation, and the repo is up-to-date and fully switchable. The world once again makes sense.
So there's all that, on the off-chance that this happens to anyone else. Seems like this has the potential to effect anyone, since permissions is Sierra+ seem to be a bit of a wonky area. Hope this helps someone at some point.
Upvotes: 1