Possible bug when reverting a branch to an older commit (and a small Git Branch Manager suggestion)

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
Micaela Monroe
Posts: 13
Joined: Mon May 17, 2021 8:20 pm

Possible bug when reverting a branch to an older commit (and a small Git Branch Manager suggestion)

Post by Micaela Monroe » Thu Jul 15, 2021 1:19 am

Hi there,

I've been playing around with the Git connector and I think I may have found an issue when trying to revert a branch in the Git History/Staging views. Here's how to reproduce:

1. Make sure the local and remote branches are in sync and that there are at least two commits on the remote and local branches.
2. Reset a branch to the second to last commit in the Git History view.
The local branch history is updated.

The application doesn't allow you to push the update back to the remote branch. Instead, the Git Staging view prompts you to pull down the commit you just reversed. I think oXygen is assuming that the commit history on the remote is correct, even though you intentionally reset the branch locally.

---

Also, for my suggestion to the Git Branch Manager: I would love a warning message that pops up when I have uncommitted changes on a branch and then attempt to switch branches. People who do this intentionally may choose to ignore the message, but absent-minded people (like me) could use that as a cue to go back and deal with uncommitted changes.

I made changes in one branch and didn't commit them (I left changes unstaged and I left changes in the staging area), the system let me switch branches. When I switched, those uncommitted changes moved to the new branch, so I nearly committed those changes to the wrong place. For the record, other Git clients exhibit the same behavior as the Git connector does now, but I would appreciate a warning message.

Thank you very much!
Micaela

sorin_carbunaru
Posts: 384
Joined: Mon May 09, 2016 9:37 am

Re: Possible bug when reverting a branch to an older commit (and a small Git Branch Manager suggestion)

Post by sorin_carbunaru » Thu Jul 15, 2021 10:14 am

Hello Micaela,

1. Please note that the action in the Git History view is actually reset, not revert. You can read about the difference here: https://www.atlassian.com/git/tutorials ... -reverting. Perhaps you had the wrong expectations thinking you have reverted a commit, when you actually reset the branch on a commit.

2. I added an issue for the warning. I think it would be a good thing for several of our clients. The issue ID is EXM-48429 (for reference purposes).

All the best wishes,
Sorin Carbunaru
Oxygen XML Editor

Micaela Monroe
Posts: 13
Joined: Mon May 17, 2021 8:20 pm

Re: Possible bug when reverting a branch to an older commit (and a small Git Branch Manager suggestion)

Post by Micaela Monroe » Thu Jul 15, 2021 7:55 pm

Thanks, Sorin! The link you sent me says that revert is an operation that affects a public branch and reset affects a local branch (or at least that's my understanding of the link), so I would expect to be able to make the revert public. Sorry if there's still something obvious I am missing.

When I right-click an older commit in the Git History, these are my only options:
image.png
image.png (7.37 KiB) Viewed 337 times
If I do a reset and then a pull using rebase, this is the error I get:
image.png
image.png (23.58 KiB) Viewed 337 times

If I want to revert a branch locally using oXygen's Git connector and then make it public, how would I go about it?

Micaela

sorin_carbunaru
Posts: 384
Joined: Mon May 09, 2016 9:37 am

Re: Possible bug when reverting a branch to an older commit (and a small Git Branch Manager suggestion)

Post by sorin_carbunaru » Mon Jul 19, 2021 5:53 pm

Hello Micaela,

First of all, I've just noticed that I had written "rebase" instead of "reset" in my previous reply. I corrected that.

Now, coming to your question, the short answer is that you cannot revert commits using the Git Client Add-on in Oxygen. At least not now. We plan to support this in the near to mid-term future.

At the moment, you can only reset a branch to a specific commit (more info in this tutorial), but this should be used only on local commits.

If you want to revert some public commits, you need another Git client (for now), and use the revert command (note that in SourceTree the corresponding action is called Reverse). This way you can first revert each desired commit, in reversed order (BTW, it seems you can also revert a range of commits), and then push these changes to the remote repo. For more details about revert and how to use it, see the Git Revert tutorial.

All the best wishes,
Sorin


Post Reply