vscode-gitlens icon indicating copy to clipboard operation
vscode-gitlens copied to clipboard

GitLens GUI implements wrong commands when pushRemote is configured

Open dseynhae opened this issue 2 years ago • 0 comments

Description

Consider a repo repo with branch main on GitHub.

Clone this repo, define a remote for your fork, and then follow these instructions:

# Checkout a new branch `new` from main.
$ git switch main
$ git checkout -b new

# Push this branch to the fork, while setting up a remote tracker.
$ git push --set-upstream fork

# In this branch, we want to PULL from `origin`, and PUSH to `fork`
$ git branch --set-upstream-to=origin/main
$ git config --local branch.${branch}.pushRemote fork

# Create a new file, and commit it
$ touch dummy
$ git add dummy
$ git commit -m "Dummy Commit"

And this is where things go wrong: The git pull will indeed pull from origin; ⚠️ But if we hit the Push button, we will push to origin, instead of fork:

image

image

The configuration file does reflect the desired intent:

[branch "dummy"]
        remote = origin
        merge = refs/heads/main
        pushRemote = fork

image

The git pull and git push commands also communicate with the respective remotes...

GitLens Version

13.1.1

VS Code Version

Version: 1.74.1 Commit: 1ad8d514439d5077d2b0b7ee64d2ce82a9308e5a Date: 2022-12-14T10:35:03.979Z Electron: 19.1.8 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Linux x64 4.12.14-122.60-default Sandboxed: Yes

Git Version

git version 2.32.0

Logs, Screenshots, Screen Captures, etc

No response

dseynhae avatar Dec 15 '22 23:12 dseynhae