Coder Social home page Coder Social logo

vscode-tgit's Introduction

TortoiseGit commands for Visual Studio Code

Introduction

Inspired by the TortoiseGit Toolbar Visual Studio extension, this extension provides commands for launching common TortoiseGit dialogs from within Visual Studio Code.

You can execute these commands either by searching for TGit in the Command Palette (Ctrl+Shift+P), or via keyboard shortcuts.

Default shortcuts

Global shortcuts:

  • (G)it (C)ommit - Ctrl+G, Ctrl+C
  • (G)it (F)etch - Ctrl+G, Ctrl+F
  • (G)it (L)og - Ctrl+G, Ctrl+L
  • (G)it (M)erge - Ctrl+G, Ctrl+M
  • (G)it (P)ull - Ctrl+G, Ctrl+P
  • (G)it P(u)sh - Ctrl+G, Ctrl+U
  • (G)it (R)ebase - Ctrl+G, Ctrl+R
  • (G)it Re(v)ert - Ctrl+G, Ctrl+V
  • (G)it Stash-L(i)st - Ctrl+G, Ctrl+I
  • (G)it Stash-P(o)p - Ctrl+G, Ctrl+O
  • (G)it Stash-S(a)ve - Ctrl+G, Ctrl+A
  • (G)it (S)witch - Ctrl+G, Ctrl+S
  • (G)it S(y)nc - Ctrl+S, Ctrl+Y
  • (G)it Clea(n)up - Ctrl+G, Ctrl+N
  • (G)it Repository (D)iff - Ctrl+G, Ctrl+D

Current file shortcuts:

  • (G)it R(e)solve - Ctrl+G, Ctrl+E
  • (G)it File (L)og - Ctrl+Shift+Alt+G, Ctrl+Shift+Alt+L
  • (G)it File (B)lame - Ctrl+Shift+Alt+G, Ctrl+Shift+Alt+B
  • (G)it File (D)iff - Ctrl+Shift+Alt+G, Ctrl+Shift+Alt+D

Bisect commands are also available, but with no preset shortcuts.

To customize shortcuts go to File -> Preferences -> Keyboard Shortcuts.

Shortcut conflicts

Since the default shortcuts will make Ctrl+G (Go To Line) inaccessible, you can change them, or just change the one for "Go To Line" to be e.g. Ctrl+G, Ctrl+G:

{ "key": "Ctrl+g Ctrl+g", "command": "workbench.action.gotoLine" }

Extension Settings

This extension contributes the tgit.launcherPath setting, specifying the full path to TortoiseGitProc.exe. It is set to the default installation path of TortoiseGit, so you might need to adjust it if you installed elsewhere.


Running the code

  • run npm install in the checkout directory to install dependencies
  • press F5 to open a new VSCode window with the extension loaded
  • run a command from the command palette by pressing Ctrl+Shift+P and typing tgit
  • set breakpoints inside src/extension.ts to debug the extension
  • find output from the extension in the debug console
  • you can relaunch the extension from the debug toolbar after changing code in src/extension.ts
  • you can also use Ctrl+R to reload the VS Code window with the extension to load any changes

Here's to productivity!

vscode-tgit's People

Contributors

dependabot[bot] avatar jhufstetlergh avatar mbinic avatar the-ress avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-tgit's Issues

Feature request - Context menu

Can we add git show log and 'git show diff` commands to context menus in explorer and in editor title tabs.

I would like to be able to click on file names in explorer and in editor tabs, or click on folders in explorer to quickly view log and diff.

No working directory found

Visual Studio Code: 1.9.1
TortoiseGIT: 2.5.0
Windows: 7 Enterprise

I get this error when trying to commit

image

Extension doesn't work in Docker devcontainer. extensionKind property in manifest should probably be set to "ui".

Doing "TGit: Show File Log" doesn't work in VS Code when using a Linux Docker DevContainer. It works for me when I'm not running in the Devcontainer. To reason is probably that by default the extension is set to install on the Linux remote host.
To solve it manifest property extensionKind should probably be set to ["ui"] as described here: https://code.visualstudio.com/api/advanced-topics/extension-host#preferred-extension-location

This should instruct VS Code to run the extension on the Windows client so it can start the TortoiseGit exe-files.

Version: 1.69.2 (system setup)
Commit: 3b889b090b5ad5793f524b5d1d39fda662b96a2a
Date: 2022-07-18T16:12:52.460Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Windows_NT x64 10.0.19042

command tgit.cleanup not found

Environment

  • Git 2.20.1.windows.1
  • TortoiseGit 2.7
  • VSCode 1.30.2 on Windows 10
  • TortoiseGit Extension 1.2.0

Problem

  1. Run TGit: Clean up command
  2. VSCode pops up command tgit.cleanup not found

The Log (Extension Host) drops

[2019-01-29 16:05:50.159] [exthost] [info] ExtensionService#_doActivateExtension mbinic.tgit-cmds {"startup":false,"activationEvent":"onCommand:tgit.cleanup"}
[2019-01-29 16:05:50.159] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\mateuszl\.vscode\extensions\mbinic.tgit-cmds-1.2.0\out\src\extension

Fails on WSL Linux-filesystem paths

I increasingly have to do work on Windows under WSL. Trying to run, eg, tgit.diff with a file mounted on the Linux filesystem doesn't work, unsurprisingly. It is theoretically possible, because any WSL path can be converted to a Windows path. One approach is to use the wslpath command. For instance, for me to get Beyond Compare to work as a git difftool I use this:

[difftool "bc3"]
        # old way 
        # cmd = \"c:/Program Files/Beyond Compare 4/BCompare.exe\" \"$LOCAL\" \"$REMOTE\" -solo
        # new way that supports WSL
        cmd="/mnt/c/Program\\ Files/Beyond\\ Compare\\ 4/BComp.exe" "$(wslpath -aw $LOCAL)" "$(wslpath -aw $REMOTE)" -solo

Here's wslpath in action:

user@sheyn:~/wc/ventus$ wslpath
wslpath: Invalid argument
Usage:
    -a    force result to absolute path format
    -u    translate from a Windows path to a WSL path (default)
    -w    translate from a WSL path to a Windows path
    -m    translate from a WSL path to a Windows path, with '/' instead of '\'

EX: wslpath 'c:\users'
user@sheyn:~/wc/ventus$ wslpath -aw ~
\\wsl$\Ubuntu\home\user```

How do I install it?

If I use the extension search inside of VS Code I can't seem to find this extension. Do I need to manually build it and install it or am I just searching for the wrong thing?

I tried searching for:

  • tgit
  • tortoise
  • vscode-tgit

Thanks

Document key remappings to use Ctrl+alt+g chord instead of Ctrl+g?

Maybe add this to the README so people who use Ctrl-G can easily still use this plugin?

[
    {
        "key": "ctrl+alt+g ctrl+alt+c",
        "command": "tgit.commit"
    },
    {
        "key": "ctrl+g ctrl+c",
        "command": "-tgit.commit"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+n",
        "command": "tgit.cleanup"
    },
    {
        "key": "ctrl+g ctrl+n",
        "command": "-tgit.cleanup"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+f",
        "command": "tgit.fetch"
    },
    {
        "key": "ctrl+g ctrl+f",
        "command": "-tgit.fetch"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+m",
        "command": "tgit.merge"
    },
    {
        "key": "ctrl+g ctrl+m",
        "command": "-tgit.merge"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+p",
        "command": "tgit.pull"
    },
    {
        "key": "ctrl+g ctrl+p",
        "command": "-tgit.pull"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+u",
        "command": "tgit.push"
    },
    {
        "key": "ctrl+g ctrl+u",
        "command": "-tgit.push"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+r",
        "command": "tgit.rebase"
    },
    {
        "key": "ctrl+g ctrl+r",
        "command": "-tgit.rebase"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+r",
        "command": "tgit.resolve"
    },
    {
        "key": "ctrl+g ctrl+e",
        "command": "-tgit.resolve"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+v",
        "command": "tgit.revert"
    },
    {
        "key": "ctrl+g ctrl+v",
        "command": "-tgit.revert"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+l",
        "command": "tgit.showLog"
    },
    {
        "key": "ctrl+g ctrl+l",
        "command": "-tgit.showLog"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+i",
        "command": "tgit.stashList"
    },
    {
        "key": "ctrl+g ctrl+i",
        "command": "-tgit.stashList"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+o",
        "command": "tgit.stashPop"
    },
    {
        "key": "ctrl+g ctrl+o",
        "command": "-tgit.stashPop"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+a",
        "command": "tgit.stashSave"
    },
    {
        "key": "ctrl+g ctrl+a",
        "command": "-tgit.stashSave"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+s",
        "command": "tgit.switch"
    },
    {
        "key": "ctrl+g ctrl+s",
        "command": "-tgit.switch"
    },
    {
        "key": "ctrl+alt+g ctrl+alt+y",
        "command": "tgit.sync"
    },
    {
        "key": "ctrl+g ctrl+y",
        "command": "-tgit.sync"
    }
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.