10 पॉइंट द्वारा GN⁺ 2024-01-08 | 1 टिप्पणियां | WhatsApp पर शेयर करें
  • GitUI एक ऐसा tool है जो terminal के अंदर Git GUI जैसी usability और सुविधा देता है। इसकी शुरुआत ऐसे use case से हुई जहां बड़े repositories में मौजूदा Git GUI रुक जाते थे या धीमे पड़ जाते थे
  • मुख्य features में keyboard-only operation, context-based help, changes की जांच·commit·amend, file·hunk·line स्तर पर stage/unstage/revert/reset, stash, push/fetch, branch management, commit log search और diff देखना शामिल है
  • Linux Git repository के 9 लाख से अधिक commits को parse करने वाली तुलना में gitui ने 24 सेकंड और 0.17GB memory दर्ज की, जबकि lazygit ने 57 सेकंड·2.6GB और tig ने 4 मिनट 20 सेकंड·1.3GB दर्ज किया
  • 1.0 से पहले के लक्ष्यों में log tab में branch structure visualization और interactive rebase शामिल हैं, और git-lfs, sparse repo, HTTPS के लिए credential.helper की automatic handling में ज्ञात limitations हैं
  • फिलहाल यह Git shell को पूरी तरह replace नहीं करता; यह stash या line·hunk स्तर की staging जैसे Git shell में असुविधाजनक कामों को पूरा करने के लिए साथ में इस्तेमाल होने वाला tool अधिक है

Git GUI अनुभव को terminal में लाने वाला tool

  • GitUI terminal में Git GUI का user experience और सुविधा देने वाला open-source tool है
  • इसे बनाने की प्रेरणा उस अनुभव से आई कि terminal में ज्यादातर Git काम करते हुए भी index, commit, diff, stash, blame, log जैसे कामों के लिए Git GUI अक्सर इस्तेमाल करना पड़ता था
  • मौजूदा लोकप्रिय Git GUI में बड़े repositories पर fail होने, responsive न रहने और unusable हो जाने की समस्या थी
  • GitUI का लक्ष्य terminal के अंदर portable, fast, free, opensource Git GUI अनुभव देना है

Feature scope

  • Operation model keyboard-only control और context-based help पर केंद्रित है, और इसे इस तरह design किया गया है कि बहुत सारे shortcuts याद रखने की जरूरत न पड़े
  • Changes से जुड़े कामों में ये शामिल हैं
    • changes inspect, commit, amend
    • pre-commit, commit-msg, post-commit, prepare-commit-msg hooks सहित
    • file, hunk, line स्तर पर stage, unstage, revert, reset
  • Repository flow से जुड़े काम भी support हैं
    • stash save, pop, apply, drop, inspect
    • remote पर push, remote से fetch
    • branch create, rename, delete, checkout, remotes देखना
    • commit log navigation और search, committed changes का diff देखना
  • UI और internal behavior में responsive terminal UI, smooth operation के लिए asynchronous Git API, submodule support शामिल हैं
  • GPG commit signing support है, लेकिन #97 से जुड़ी constraints हैं

Benchmark results

  • RustBerlin meetup presentation में lazygit, tig, gitui की तुलना पूरे Linux Git repository को parse करके की गई
    • target repository में 9 लाख से अधिक commits शामिल हैं
    • presentation material RustBerlin meetup presentation और slides से link है
  • तुलना के नतीजे इस प्रकार हैं
    • gitui: 24 सेकंड, 0.17GB memory, 10MB binary, कोई freeze नहीं, कोई crash नहीं
    • lazygit: 57 सेकंड, 2.6GB memory, 25MB binary, freeze होता है, crash कभी-कभी होता है
    • tig: 4 मिनट 20 सेकंड, 1.3GB memory, 0.6MB binary, freeze कभी-कभी होता है, crash नहीं
  • इस तुलना में gitui ने time और memory categories में सबसे कम values दर्ज कीं

1.0 से पहले का roadmap और ज्ञात limitations

  • 1.0 कहे जाने से पहले दो top-level goals हैं
    • log tab में branch structure visualization: #81
    • interactive rebase: #32
  • मौजूदा limitations में ये शामिल हैं
    • git-lfs unsupported: #2812
    • sparse repo unsupported: #1226
    • HTTPS में credential.helper को explicitly set करना जरूरी है: #800
  • GitUI फिलहाल Git shell को पूरी तरह replace नहीं करता, और दोनों tools को साथ में इस्तेमाल करने का तरीका ज्यादा उपयुक्त है
  • Priority उन features पर है जो Git shell में असुविधाजनक हैं, जैसे stash और line·hunk स्तर की staging
  • Project अभी spare time project है, और GitUI को one stop solution बनाने के लिए मदद की जरूरत है

Installation और build

  • GitUI beta state में है और bugs व missing features हो सकते हैं
  • personal use के लिए यह reasonably stable है, और GitUI के अपने development में भी इस्तेमाल हो रहा है
  • इसे कई package managers से install किया जा सकता है
    • Arch Linux: pacman -S gitui
    • Fedora: sudo dnf install gitui
    • openSUSE: sudo zypper install gitui
    • Homebrew: brew install gitui
    • MacPorts: port install gitui
    • Winget: winget install gitui
    • Scoop: scoop install gitui
    • Chocolatey: choco install gitui
    • Mise: mise use -g gitui@latest
    • Termux: pkg install gitui
    • Anaconda: conda install -c conda-forge gitui
  • Release binaries Linux, macOS, Windows के लिए उपलब्ध हैं
    • Linux के लिए x86_64, aarch64, arm, armv7 packages हैं
    • macOS के लिए arm64 और Intel x86 packages हैं
    • Windows के लिए 64bit single binary और 64bit MSI installer package है
  • Build requirements इस प्रकार हैं
    • minimum supported rust/cargo version 1.88 है
    • OpenSSL dependency build करने के लिए perl 5.12 या उससे ऊपर और C compiler जरूरी है
    • पूरा test suite चलाने के लिए python के रूप में callable Python जरूरी है
  • Cargo से cargo install gitui --locked command के जरिए build और installation शुरू किया जा सकता है
  • trace-libgit Cargo feature libgit2 tracing को enable करता है, और तब काम करता है जब libgit2 -DENABLE_TRACE=ON के साथ build किया गया हो
  • यह feature default रूप से enabled है, और disable करने के लिए cargo install --no-default-features का उपयोग करें

Settings, diagnostics, customization

  • Logging gitui -l से enable की जाती है
  • Log file location platform के अनुसार अलग है
    • macOS: $HOME/Library/Caches/gitui/gitui.log
    • Linux with XDG: $XDG_CACHE_HOME/gitui/gitui.log
    • Linux: $HOME/.cache/gitui/gitui.log
    • Windows: %LOCALAPPDATA%/gitui/gitui.log
  • GitUI को light और dark terminal themes दोनों में automatically काम करना चाहिए
  • Color theme को THEMES.md के अनुसार मनचाहे तरीके से customize किया जा सकता है
  • Key bindings को KEY_CONFIG.md के अनुसार customize किया जा सकता है, और vim style bindings के रूप में set किया जा सकता है
  • inspiration के तौर पर बताए गए projects हैं lazygit, tig, GitUp, git-brunch
  • GitUp के बारे में यह लक्ष्य भी जोड़ा गया है कि terminal tool में map view इस्तेमाल करने का तरीका मिल जाए तो अच्छा होगा

1 टिप्पणियां

 
GN⁺ 2024-01-08
Hacker News की राय
  • इंस्टॉल करते ही xterm विंडो बहुत छोटी थी, इसलिए उसे बड़ा किया, और फ़ाइल ट्री एरिया के किनारे को drag करके छोटा करने की कोशिश की, लेकिन यह संभव नहीं था
    मैं diff को बड़ा देखना चाहता था और फ़ाइल नाम भी छोटे थे, इसलिए ट्री एरिया का ज़्यादातर हिस्सा बेकार जा रहा था; H help में भी इससे जुड़ी कोई key नहीं थी, इसलिए लगता है कि keyboard से भी resize नहीं किया जा सकता
    भले ही keyboard से संभव हो, ऐसे मामलों में mouse resize कहीं ज़्यादा आसान और तेज़ है, और टूटे हुए SSH environment जैसे हालात में, जहाँ mouse इस्तेमाल नहीं कर सकते, keyboard adjustment भी हो तो अच्छा होगा

    • keyboard shortcuts के साथ terminal mouse support जोड़ना सच में उपयोगी है
      Vim में भी trackpad/mouse जिन हिस्सों में अब भी इस्तेमाल करता हूँ, वे scrolling और window resizing हैं, और SSH के पार भी दोनों उपलब्ध न कर पाने की कोई वजह नहीं है
      यहाँ भी यह एक अच्छा additional feature होगा
  • lazygit को इस project की inspiration के रूप में लिखा गया है, लेकिन lazygit user के तौर पर मैं जानना चाहता हूँ कि क्या कमी थी जिसके लिए पूरी तरह नया project ज़रूरी हो गया
    मैं lazygit को बहुत उपयोगी तरीके से इस्तेमाल कर रहा हूँ

    • methodology सही है या नहीं, यह तय करना मुश्किल है, लेकिन manager की नज़र से numbers काफ़ी प्रभावशाली हैं
      RustBerlin meetup presentation के लिए पूरे Linux Git repository को parse करके lazygit, tig, gitui की तुलना की गई थी, और repository में 9 लाख से ज़्यादा commits थे
      gitui ने 24 सेकंड लिए, memory 0.17GB, binary 1.4MB, कोई freeze नहीं, कोई crash नहीं; lazygit ने 57 सेकंड, 2.6GB, 16MB, freeze हुआ, कभी-कभी crash हुआ; और tig ने 4 मिनट 20 सेकंड, 1.3GB, 0.6MB, कभी-कभी freeze, कोई crash नहीं
    • मैं कई सालों से lazygit रोज़ इस्तेमाल कर रहा हूँ और कुछ महीने पहले इसे भी आज़माया था; यह लगभग perfect tool को Rust में फिर से लिखने के लिए बनाया गया case जैसा लगा
      मेरी याद में lazygit में न होने वाला कोई feature इसमें नहीं था, बल्कि lazygit में मौजूद कुछ features इसमें गायब थे
    • README में motivation लिखा है
      ज़्यादातर Git काम terminal में करता हूँ, लेकिन index, commit, diff, stash, blame, log जैसे use cases में Git GUI अक्सर इस्तेमाल करने लगा; कहा गया है कि popular Git GUIs बहुत बड़े repositories में fail हो जाते थे या unresponsive हो जाते थे, इसलिए usable नहीं थे
  • “popular Git GUIs बहुत बड़े repositories में fail हो जाते हैं या unresponsive हो जाते हैं” वाली बात मैंने सिर्फ़ तब देखी है जब .gitignore में अभी तक न डाली गई बहुत गहरी directory tree की वजह से git status command line या magit में बहुत समय लेता है
    ऐसे मामलों में GUI/TUI/command-line Git इस्तेमाल के बीच कोई फर्क नहीं दिखता
    क्या दूसरे Git interfaces, Git खुद से ज़्यादा dramatic तरीके से fail होते हैं?

    • मुझे लगता है Magit का failure pattern status page पर diff information खींचने वाली sub-action की वजह से है
      वही problem होने पर भी command line में git status लगभग तुरंत खत्म हो गया था
      बहुत सारी information दिखानी हो तो समय लगना unavoidable है, लेकिन magit कुछ points पर बहुत eager तरीके से चलता है और raw Git flow की तुलना में कहीं ज़्यादा महंगा workflow बना देता है
    • बड़ा merge मैं magit में कभी नहीं करता; उसके लिए Git CLI इस्तेमाल करता हूँ
    • अगर ऐसा है तो यह surprising है
      IntelliJ का Git UI Java में लिखा है और IDE के अंदर included है, फिर भी काफी fast है, इसलिए external Git UI में problem नहीं होनी चाहिए
  • संबंधित पोस्ट:
    GitUI: Terminal UI for Git - https://news.ycombinator.com/item?id=32864036 - सितंबर 2022, 90 comments
    Terminal-UI for Git written in Rust - https://news.ycombinator.com/item?id=25504811 - दिसंबर 2020, 1 comment

  • क्या किसी ने Git में click-and-drag UI बनाया है?
    मतलब ऐसा UI जिसमें branch को बस drag and drop करके काम किया जा सके

    • मेरा पसंदीदा Git GUI Fork है: https://git-fork.com/
      merge, rebase, stage/unstage आदि कई operations के लिए drag and drop support करता है, और शायद और भी चीज़ें होंगी
    • basic कामों के लिए GitHub Desktop इस्तेमाल करता हूँ और complex चीज़ों के लिए CLI
      यह काफी simple Git client है, लेकिन commit cherry-pick जैसे कामों के लिए थोड़ी drag functionality है
    • एक extension देखा था जो ऐसी चीज़ को अपने advertised features में से एक बताता था, लेकिन इस्तेमाल नहीं किया
      https://marketplace.visualstudio.com/items?itemName=trunkflo...
    • 10 साल बाद भी जब UI में click and drag की ज़रूरत होती है, तब भी मैं मुख्यतः SourceTree इस्तेमाल करता हूँ
  • ऐसे tools सब आज़माता हूँ, लेकिन हमेशा कोई core feature missing होता है या मेरे चाहने के तरीके से काम नहीं करता, इसलिए आखिरकार tig पर लौट आता हूँ
    GitUI में Log view जैसी जगहों पर branch structure को अच्छी तरह दिखाने वाला visualization नहीं मिला
    अच्छा होगा अगर rebase को ध्यान में रखते हुए branch structure को साफ़ दिखाने वाला tool हो

  • अच्छा लग रहा है, इसलिए एक बार try करने का सोच रहा हूँ
    उम्मीद है कि कभी GitExtensions को native Linux application के रूप में port किया जाएगा
    दर्जनों UIs इस्तेमाल कर चुका हूँ, लेकिन उसके जैसा कुछ नहीं लगता

    • Linux पर आने के बाद रोज़ जिस एकमात्र Windows app की कमी महसूस होती है, वह TortoiseGit है
      context-menu based system को TortoiseGit जितनी naturally इस्तेमाल कराने वाला Git UI अभी तक नहीं मिला
    • हमेशा हैरानी होती है कि GitExtensions को जानने वाले developers इतने कम हैं
      उसके करीब आने वाला दूसरा Git UI सिर्फ़ Tortoise है, हालांकि पहले मैंने सिर्फ़ hg variant इस्तेमाल किया था
    • Gitex शानदार है
      Linux पर अब भी 2.x mono version इस्तेमाल कर रहा हूँ
  • लगभग एक महीने पहले से इस्तेमाल शुरू किए Neovim plugin neogit से यह बहुत मिलता-जुलता दिखता है
    key bindings थोड़े rough थे और पूरे workflow की सच में आदत पड़ने में करीब एक घंटा लगा, लेकिन आदत पड़ने के बाद यह मेरे पुराने तरीके—neovim को suspend करके shell में सीधे Git इस्तेमाल करने—से कहीं तेज़ हो गया
    0: https://github.com/NeogitOrg/neogit

  • UI tools को लेकर मेरी एक चिंता यह है कि वे अक्सर actual commands को user से छिपा देते हैं, जिससे बाद में यह reason करना मुश्किल हो जाता है कि क्या गलत हुआ और आगे उससे कैसे बचें
    उदाहरण के लिए कोई tool ऐसे काफी opinionated flags लगा सकता है जो सामान्य CLI flow से मेल नहीं खाते
    मुझे नहीं पता कि यह इस tool पर लागू होता है या नहीं, लेकिन इस category के tools के लिए यह दिलचस्प feedback हो सकता है

    • इसलिए Windows पर मैं GitExtensions इस्तेमाल करता हूँ और पसंद करता हूँ
      यह हमेशा पूरा command दिखाता है जो चलाया जा रहा है, और पूरा log भी पूरी तरह देखा जा सकता है