vscode-git-graph icon indicating copy to clipboard operation
vscode-git-graph copied to clipboard

on checkout branch automatically merge actual branch into it

Open rbalet opened this issue 6 years ago • 13 comments

Describe the Bug
On checkout an old branch, the actual branch get directly merge into it.

Steps to Reproduce I cannot come with a precise step to reproduce, I will update the issue if I find out

  1. Create 2 different branch (master and develop which is created from master)
  2. checkout develop, add > 20 commits
  3. checkout master and develop get automatically merged into it.

Environment

  • Git Graph Extension Version: [e.g. 1.22.0]
  • Visual Studio Code Version: [e.g. 1.43.0]
  • Operating System: [e.g. Windows 10]

rbalet avatar Mar 22 '20 08:03 rbalet

I've tried this out and cannot replicate the bug in any way. There is also no reason (confirmed after checking the code) for develop to be merged into master when you run the checkout action. There also isn't any changes that I could think could possibly be related to this that were introduced in Git Graph 1.22.0.

Please provide an exact set of steps to replicate the bug you describe as to me it seems extremely unlikely it is caused by the extension. If this is actually a bug, I need to fix it ASAP. When you do observe the issue, take a look (and include in your reply) the Git Graph Output Channel in Visual Studio Code, as it would have to include a git merge ... log entry if the extension performed the merge while checking the branch out.

mhutchie avatar Mar 22 '20 09:03 mhutchie

I’ll close this bug for now as:

  • You haven’t provided an exact set of steps to replicate it. (I’ve checked the steps you have provided and can’t replicate the bug following them)
  • After reviewing the code, there isn’t any logical reason why a merge would be triggered when a branch is checked out (the command wouldn’t even have enough information to know which branch to merge).
  • It doesn’t appear that anything that could cause the bug you describe was introduced / changed in Git Graph 1.22.0.
  • For such a high traffic action as check out, if it were a bug I would have expected many other users to have also reported it.
  • I’ve tested many combinations of checking out branches (outside of the steps you provided), and also couldn’t observe the bug you’re describing.

Of course if this is a bug and you can produce a reproducible set of steps, and include the Git Graph Output Channel to confirm the extension ran a merge command as well as the intended checkout command, please reply to this thread so I can re-open it, replicate it, and fix it. If there is a bug, I obviously want to fix it as soon as possible, it’s just that all of my above points indicate to me that it is very unlikely that it is caused by Git Graph.

mhutchie avatar Mar 22 '20 21:03 mhutchie

I am having the exact same issue. It's like the 1000th time it happens. However it's very random. It doesn't happen in a consistent way.

I can definitely guarantee it's happening. There are no bad user interactions involved. Again, I reinforce that it's not consistent, It doesn't happen al the time.

The "consistent" steps to reproduce it are always "create branch from development branch" > "make changes & commit & push" > "checkout to branch development" and BOOM changes are merged automatically . . . But again it doesn't happen all the time!

SamuelFerreiraJimpisoft avatar Dec 09 '22 14:12 SamuelFerreiraJimpisoft

@mhutchie I would let this open till we find a stable step to reproduce. That said I didn't had the problem anymore (I've changed for a much more powerful laptop, so this may have done the trick).

It looks to me like a promise that isn't awaited properly.

rbalet avatar Dec 09 '22 14:12 rbalet

It happens to me too, sometimes.

I believe it's a timing issue. It seems to happen for me when clicking "Switch to Branch...", and while it is thinking clicking Source Control > ... > Pull. It then pulls the previous branch into the switched to branch.

magnusjacobsen avatar Apr 25 '23 12:04 magnusjacobsen

@mhutchie Could we open this issue but let it with a Hold: Step to reproduce label or something else ?

Since the problem does clearly exists somewhere

rbalet avatar Apr 25 '23 14:04 rbalet

Same issue for two members of my team. We cannot replicate the issue because is very random. After the issue occurred we found a merge commit in the destination branch named "Merge branches 'feature/origin-feature' and 'develop' of github.com:my-repository into develop"

maseba avatar May 15 '23 11:05 maseba

I also often get this issue with the same repro steps. It also occurs randomly for me and I have to hard reset to my main branch when it happens.

kaiza avatar Oct 25 '23 05:10 kaiza

Just encountered the same issue in our team. Luckily right AFTER releasing and not in a gitops repo.

gadse avatar Nov 07 '23 12:11 gadse

I actually have this exact same intermittent issue when using my PowerShell alias:

# m => git stash; git checkout main; git pull
function Invoke-Git-Stash-Pull-Main {
    $ErrorActionPreference = "Stop"
    & git stash
    & git checkout main
    & git pull
    Write-Host Ran $MyInvocation.MyCommand from `$profile
}
New-Alias -Name m -Value Invoke-Git-Stash-Pull-Main

I don't and never have used Git Graph, so I think this is perhaps an issue with git itself. Unless someone can find an issue with my PS script that is causing it. Anyway, I found this issue via a Google search and hopefully my input will be useful to others.

I'm on: git version 2.40.0.windows.1

Stan-Stani avatar Dec 19 '23 21:12 Stan-Stani

Just got bit by this. Switched branch onto master and performed a sync. The branch I'd left was silently merged in. This is definitely a thing, and it's horrific.

BenWeigt avatar Feb 12 '24 11:02 BenWeigt

It happens to me as well, I am using VSCode and I think this happens when VSCode is doing auto fetch and meanwhile we switch branch, it merges the old branch to the switched branch.

gopaldubeyvns avatar May 28 '24 06:05 gopaldubeyvns

I had the same experience many times. It had started last year, approximately at October 2023. I worked on different personal computers and had experienced the same issue

ianiskondakov avatar May 30 '24 21:05 ianiskondakov