मुफ़्त Git कमांड जनरेटर

एक विज़ुअल इंटरफ़ेस से सामान्य Git कमांड बनाएं। मुफ़्त, तेज़ और पूरी तरह आपके ब्राउज़र में काम करता है, बिना साइन-अप के।

अपडेट किया गया

Share:
Home/Developer Tools/Git Command Generator

Git Command Generator

Generate common Git commands with a visual interface. Perfect for learning Git.

Select Operation

Basic
Branching
Remote
History & Recovery
Advanced

Commit Changes
Basic

Record changes to the repository

Generated Command

$ git commit -m "Your commit message"
Shell Alias
alias gcommit='git commit -m "Your commit message"'
Undo & Fix
Branching
Cleanup
Collaboration
Release & Deploy

Undo last commit (keep changes)
Undo & Fix

Undo the most recent commit but keep your changes staged

$ git reset --soft HEAD~1

This moves HEAD back one commit, leaving your changes staged. You can then edit files and commit again.

Undo last commit (discard changes)
Undo & Fix

Completely remove the last commit and all its changes

$ git reset --hard HEAD~1

WARNING: This permanently deletes the last commit and all uncommitted changes. Use git reflog to recover if needed.

Amend last commit message
Undo & Fix

Change the message of your most recent commit

$ git commit --amend -m "New commit message"

Replaces the last commit message. Only do this if you haven't pushed yet, as it rewrites history.

Unstage all files
Undo & Fix

Remove all files from the staging area

$ git reset HEAD

Unstages all files without modifying your working directory. Files remain modified but are no longer staged.

Discard all local changes
Undo & Fix

Reset working directory to match the last commit

$ git checkout -- .
# Or use: git restore .

Discards all uncommitted changes in tracked files. Untracked files are not affected.

Recover deleted branch
Undo & Fix

Restore a branch that was accidentally deleted

$ git reflog
# Find the commit hash, then:
$ git checkout -b recovered-branch <commit-hash>

Use reflog to find the last commit of the deleted branch, then create a new branch at that commit.

Create feature branch
Branching

Start working on a new feature from main

$ git checkout main
$ git pull origin main
$ git checkout -b feature/my-feature

Ensures you start from the latest main branch, then creates and switches to a new feature branch.

Squash last N commits
Branching

Combine multiple commits into one

$ git reset --soft HEAD~3
$ git commit -m "Combined commit message"

Soft resets N commits back, keeping all changes staged, then creates one new commit. Replace 3 with your number.

Rebase feature on main
Branching

Update your feature branch with latest main changes

$ git checkout feature/my-feature
$ git fetch origin
$ git rebase origin/main

Replays your feature commits on top of the latest main. Resolve conflicts if any arise, then continue.

Cherry-pick a commit
Branching

Apply a specific commit from another branch

$ git log --oneline other-branch
# Find the commit hash, then:
$ git cherry-pick <commit-hash>

Creates a new commit on your current branch with the same changes as the specified commit.

Remove untracked files
Cleanup

Clean up untracked files and directories

$ git clean -n
# Preview first, then:
$ git clean -fd

The -n flag shows what would be deleted. The -f flag forces deletion and -d includes directories.

Remove file from tracking
Cleanup

Stop tracking a file but keep it locally

$ git rm --cached path/to/file
$ echo "path/to/file" >> .gitignore
$ git commit -m "Remove file from tracking"

Removes the file from Git tracking without deleting it from your filesystem. Add it to .gitignore to prevent re-adding.

Prune remote branches
Cleanup

Remove local references to deleted remote branches

$ git fetch --prune
$ git branch -vv | grep "gone"
# Delete stale branches:
$ git branch -d <branch-name>

Fetches and removes references to remote branches that no longer exist, then shows stale local branches.

Resolve merge conflicts
Collaboration

Steps to handle merge conflicts

$ git status
# Edit conflicted files, then:
$ git add .
$ git commit -m "Resolve merge conflicts"

Check which files have conflicts, edit them to resolve the markers (<<<< ==== >>>>), stage and commit.

Stash and switch branches
Collaboration

Save work temporarily to switch branches

$ git stash -u -m "WIP: my changes"
$ git checkout other-branch
# When done, switch back:
$ git checkout original-branch
$ git stash pop

Stashes all changes (including untracked), switches branch, and later restores them with stash pop.

Pull with rebase
Collaboration

Sync with remote without creating merge commits

$ git pull --rebase origin main

Fetches changes and replays your local commits on top. Keeps a cleaner, linear history than merge.

Create a release tag
Release & Deploy

Tag a release version with annotation

$ git tag -a v1.0.0 -m "Release version 1.0.0"
$ git push origin v1.0.0

Creates an annotated tag with a message and pushes it to the remote. Use semantic versioning.

Create release archive
Release & Deploy

Create a zip archive of the current state

$ git archive --format=zip --output=release.zip HEAD

Creates a zip file containing all tracked files at the current HEAD, without the .git directory.

Bisect to find a bug
Release & Deploy

Binary search through commits to find when a bug was introduced

$ git bisect start
$ git bisect bad HEAD
$ git bisect good v1.0.0
# Test each commit, then:
$ git bisect good # or git bisect bad
# When done:
$ git bisect reset

Git checks out commits between good and bad. You test each one and mark it. Git narrows down the offending commit.

अक्सर पूछे जाने वाले प्रश्न

Git Command Generator क्या है?

Git Command Generator एक मुफ़्त ऑनलाइन टूल है जो आपको सिंटैक्स याद किए बिना एक विज़ुअल इंटरफ़ेस के माध्यम से सामान्य Git कमांड बनाने में मदद करता है।

क्या Git Command Generator मुफ़्त है?

हाँ, यह पूरी तरह मुफ़्त है और इसके लिए किसी पंजीकरण की आवश्यकता नहीं है। यह पूरी तरह आपके ब्राउज़र में चलता है।

क्या यह Git के शुरुआती लोगों के लिए अच्छा है?

हाँ, Git Command Generator उन शुरुआती लोगों के लिए एकदम सही है जो Git कमांड सीखना चाहते हैं, और उन अनुभवी डेवलपर्स के लिए भी जिन्हें त्वरित संदर्भ की आवश्यकता होती है।

क्या इस टूल के साथ मेरा डेटा सुरक्षित है?

बिल्कुल। Git Command Generator सब कुछ आपके ब्राउज़र में क्लाइंट-साइड पर प्रोसेस करता है। कोई भी डेटा किसी सर्वर पर अपलोड या संग्रहीत नहीं किया जाता। आपका कंटेंट हर समय आपके डिवाइस पर निजी रहता है।

क्या Git Command Generator मोबाइल उपकरणों पर काम करता है?

हाँ, Git Command Generator पूरी तरह रिस्पॉन्सिव है और स्मार्टफ़ोन व टैबलेट पर काम करता है। आप इसे आधुनिक वेब ब्राउज़र वाले किसी भी डिवाइस पर इस्तेमाल कर सकते हैं, किसी ऐप को डाउनलोड करने की ज़रूरत नहीं।

क्या इस टूल का उपयोग करने के लिए मुझे खाता बनाना होगा?

किसी खाते या पंजीकरण की आवश्यकता नहीं है। बस अपने ब्राउज़र में Git Command Generator खोलें और तुरंत इस्तेमाल शुरू करें। कोई साइन-अप बाधा या उपयोग प्रतिबंध नहीं है।

यह किन प्रोग्रामिंग भाषाओं या प्रारूपों का समर्थन करता है?

Git Command Generator कई लोकप्रिय प्रारूपों और भाषाओं का समर्थन करता है। समर्थित विकल्पों की पूरी सूची के लिए टूल का इंटरफ़ेस देखें।

मैं Git Command Generator का उपयोग कैसे करूँ?

बस दिए गए फ़ील्ड में अपना इनपुट दर्ज करें, अपनी पसंद के अनुसार सेटिंग्स समायोजित करें, और टूल इसे तुरंत प्रोसेस कर देगा। फिर आप परिणाम को क्लिपबोर्ड पर कॉपी कर सकते हैं या डाउनलोड कर सकते हैं।

कौन-कौन से ब्राउज़र समर्थित हैं?

Git Command Generator सभी आधुनिक ब्राउज़रों में काम करता है, जिनमें Chrome, Firefox, Safari, Edge और Opera शामिल हैं। सर्वोत्तम अनुभव के लिए अपने पसंदीदा ब्राउज़र के नवीनतम संस्करण का उपयोग करें।

git push --force और --force-with-lease में क्या अंतर है?

दोनों रिमोट ब्रांच को आपके लोकल इतिहास से ओवरराइट कर देते हैं, जिसकी ज़रूरत आमतौर पर rebase करने या कमिट amend करने के बाद पड़ती है। फ़र्क सुरक्षा का है। सादा --force हर हाल में पुश कर देता है, इसलिए अगर आपके आखिरी fetch के बाद किसी साथी ने नई कमिट्स पुश की हैं, तो --force उन्हें चुपचाप मिटा देता है। --force-with-lease पहले यह जांचता है कि रिमोट अभी भी वहीं है जहां आपको उम्मीद थी; अगर इस बीच किसी और ने पुश किया है, तो पुश रिजेक्ट हो जाता है बजाय उनके काम को मिटाने के। यही वजह है कि शेयर की गई ब्रांचों के लिए --force-with-lease ज़्यादा सुरक्षित डिफ़ॉल्ट है। यह जनरेटर push ऑपरेशन पर दोनों विकल्प देता है और सादे --force को खतरनाक बताकर फ्लैग करता है, साथ ही सुरक्षित lease वैरिएंट को भी ठीक बगल में दिखाता है। push चुनें, अपना चाहा ऑप्शन टॉगल करें, और सटीक कमांड कॉपी करके अपने टर्मिनल में पेस्ट करें।

Git में बदलाव बनाए रखते हुए आख़िरी कमिट को कैसे पूर्ववत करें?

hard reset की बजाय soft या mixed reset इस्तेमाल करें। git reset --soft HEAD~1 चलाने से आख़िरी कमिट हट जाती है लेकिन हर बदलाव staged रहता है, दोबारा कमिट करने के लिए तैयार; git reset HEAD~1 (एक mixed reset, जो डिफ़ॉल्ट भी है) बदलावों को आपकी working directory में रखता है पर उन्हें unstage कर देता है। ज़रूरी बात यह है कि git reset --hard HEAD~1 से बचें, जो कमिट को डिलीट करके उन बदलावों को हमेशा के लिए मिटा देता है, बिना किसी ट्रैश बिन के जिससे उन्हें वापस लाया जा सके। अगर आपको सिर्फ़ कमिट मैसेज ठीक करना है या कोई भूली हुई फ़ाइल जोड़नी है, तो git commit --amend अक्सर reset करने से ज़्यादा साफ़-सुथरा तरीका है। यह जनरेटर reset ऑपरेशन को soft, mixed और hard मोड के साथ शामिल करता है, hard विकल्प को खतरनाक बताता है, और कॉपी करने से पहले ठीक-ठीक बताता है कि हर एक आपके working tree के साथ क्या करेगा।

git stash क्या करता है और मैं अपने बदलाव वापस कैसे पाऊं?

git stash आपके अनकमिटेड बदलावों को एक अस्थायी स्टैक पर सहेज देता है और आपकी working directory को एक साफ़ स्थिति में लौटा देता है, जो तब काम आता है जब आपको आधा-अधूरा काम कमिट किए बिना ब्रांच बदलनी हो या अपडेट पुल करने हों। आपके बदलाव खोते नहीं हैं; वे तब तक stash स्टैक पर रहते हैं जब तक आप उन्हें वापस नहीं लाते। उन्हें वापस लाने के लिए git stash pop चलाएं, जो सबसे हाल के stash को फिर से लागू कर देता है और उसे स्टैक से हटा देता है, या git stash apply, जो उसे फिर से लागू करता है लेकिन उसकी एक कॉपी स्टैक पर रखता है। जो कुछ भी सहेजा है उसे देखने के लिए git stash list इस्तेमाल करें। git stash clear से सावधान रहें, जो सभी stash किए गए बदलावों को हमेशा के लिए मिटा देता है। यह जनरेटर stash, pop, apply, list और clear को कवर करता है, और विनाशकारी clear विकल्प को फ्लैग करता है ताकि आपको पता रहे कि कौन-सा काम पूर्ववत नहीं किया जा सकता।

shallow clone क्या है और --depth 1 का इस्तेमाल कब करना चाहिए?

shallow clone किसी रिपॉज़िटरी को उसके पूरे कमिट इतिहास के बिना कॉपी करता है। git clone में --depth 1 जोड़ने पर प्रोजेक्ट की शुरुआत से अब तक की हर कमिट की बजाय हर ब्रांच पर सिर्फ़ सबसे हाल की कमिट लाई जाती है, जिससे बड़ी रिपॉज़िटरी के लिए डाउनलोड साइज़ और समय काफ़ी कम हो जाता है। यह continuous integration पाइपलाइनों, Docker बिल्ड्स, और ऐसी किसी भी स्थिति के लिए आदर्श है जहां आपको सिर्फ़ मौजूदा कोड चाहिए और पुराने इतिहास की परवाह नहीं है। इसका ट्रेड-ऑफ़ यह है कि इतिहास पर निर्भर कमांड्स, जैसे पुरानी कमिट्स पर git log या बहुत पीछे तक git blame, तब तक ज़रूरी डेटा नहीं पा सकेंगी जब तक आप क्लोन को unshallow न कर दें। इस जनरेटर के clone ऑपरेशन में shallow --depth 1 टॉगल के साथ-साथ किसी खास --branch और --recursive सबमॉड्यूल पुल के विकल्प भी शामिल हैं, ताकि आप सटीक clone कमांड बना सकें और एक क्लिक में कॉपी कर सकें।

मर्ज करने से पहले कई कमिट्स को एक में कैसे स्क्वैश करें?

Squashing कई कमिट्स को एक ही साफ़-सुथरी कमिट में मिला देता है, जिससे फ़ीचर ब्रांच मर्ज करने से पहले आपके प्रोजेक्ट का इतिहास पढ़ने लायक बना रहता है। सामान्य तरीका है interactive rebase, यानी git rebase -i HEAD~N, जहां N बताता है कि आप कितनी कमिट्स पीछे तक देखना चाहते हैं; इसके बाद आप उन कमिट्स को चिह्नित करते हैं जिन्हें एक साथ मिलाना है। इसके अलावा, git merge --squash branch-name किसी ब्रांच के सभी बदलावों को एक सेट के रूप में stage कर देता है ताकि आप individual कमिट्स लाए बिना target ब्रांच पर एक ही कमिट बना सकें। Squashing इतिहास को फिर से लिखता है, इसलिए ऐसी कमिट्स पर इसे न करें जो पहले ही किसी शेयर की गई ब्रांच पर पुश की जा चुकी हैं, जब तक कि आप अपनी टीम के साथ तालमेल न बिठा लें। यह जनरेटर merge ऑपरेशन को --squash टॉगल के साथ शामिल करता है और बताता है कि यह क्या करता है, जिससे आप कमांड बना सकें और रिज़ल्ट सही लगने पर उसे अपने टर्मिनल में पेस्ट कर सकें।

Embed This Tool

Add a free, live version of this widget to your own website or blog post — it runs entirely in your visitors' browsers, with a credit link back to The Toolbox.

Copy & paste this HTML
<iframe src="https://getthetoolbox.com/embed/git-command-generator" title="Free Git Command Generator — The Toolbox" width="100%" height="320" style="max-width:480px;border:1px solid #e2e8f0;border-radius:12px" loading="lazy"></iframe>
<p style="font-size:12px;margin:4px 0 0"><a href="https://getthetoolbox.com/developer-tools/git-command-generator?utm_source=embed&utm_medium=widget" target="_blank" rel="noopener">Free Git Command Generator</a> by The Toolbox</p>

संबंधित टूल

फ्री Git Command Generator के बारे में

Git Command Generator एक विज़ुअल इंटरफ़ेस के ज़रिए आपके लिए सही Git कमांड बनाता है, ताकि आपको कभी man pages खंगालने या फ्लैग्स का सही क्रम अंदाज़ा लगाने की ज़रूरत न पड़े। कोई ऑपरेशन चुनें, एक-दो फ़ील्ड भरें, जो ऑप्शन चाहिए उन्हें टॉगल करें, और सटीक कमांड टर्मिनल-स्टाइल प्रीव्यू में खुद तैयार हो जाता है, कॉपी-पेस्ट के लिए एकदम तैयार। यह उन सभी के लिए है जो Git इस्तेमाल तो करते हैं पर उसका सिंटैक्स याद नहीं रखना चाहते: बुनियादी बातें सीख रहे शुरुआती, अपना पहला रिपॉज़िटरी संभाल रहे स्टूडेंट्स, और अनुभवी डेवलपर्स जिन्हें बस महीने में एक बार इस्तेमाल होने वाले किसी फ्लैग की याद दिलानी हो।

सब कुछ आपके ब्राउज़र में ही चलता है। कोई साइन-अप नहीं, कुछ भी अपलोड नहीं होता, और आप जो भी कमांड, ब्रांच नाम या कमिट मैसेज टाइप करते हैं वह कभी आपकी डिवाइस से बाहर नहीं जाता। यह टूल टेक्स्ट लोकली जनरेट करता है और पेज एक बार लोड होने के बाद ऑफ़लाइन भी काम करता है।

आप क्या-क्या जनरेट कर सकते हैं

यह जनरेटर रोज़मर्रा के Git वर्कफ़्लो के साथ-साथ वे ऑपरेशन भी कवर करता है जिन्हें लोग अक्सर सर्च करते हैं। कमांड्स को कैटेगरी में बांटा गया है ताकि आप स्क्रॉल करने के बजाय ब्राउज़ कर सकें:

  • Basicclone, init, add, commit, push, pull
  • Branchingbranch, checkout/switch, merge, rebase
  • Remotefetch, remote, और अपस्ट्रीम ट्रैकिंग
  • Historylog, diff, reset, stash, tag, reflog
  • Advancedcherry-pick, revert, clean, bisect, blame, worktree, archive

हर ऑपरेशन के अपने फ़ॉर्म फ़ील्ड और टॉगल किए जा सकने वाले फ्लैग्स होते हैं। उदाहरण के लिए, क्लोनिंग में एक शैलो --depth 1 क्लोन, कोई खास --branch, और सबमॉड्यूल्स के लिए --recursive पुल का विकल्प मिलता है; कमिट में --amend, -a, -S से GPG साइनिंग और भी बहुत कुछ मिलता है। हर कमांड के साथ एक छोटा-सा सरल हिंदी/अंग्रेज़ी में स्पष्टीकरण होता है, जिससे यह टूल एक चीटशीट की तरह भी काम करता है जो आपको बताता है कि हर ऑप्शन असल में करता क्या है।

आम कामों के लिए झटपट रेसिपी

अलग-अलग कमांड्स के अलावा, यह जनरेटर उन सवालों के लिए तैयार रेसिपी भी देता है जिन्हें लोग सबसे ज़्यादा सर्च करते हैं: बदलाव रखते हुए आख़िरी कमिट को पूर्ववत करना, लोकल बदलाव हटाना, आख़िरी N कमिट्स को स्क्वैश करना, reflog से डिलीट हुई ब्रांच वापस लाना, फ़ीचर ब्रांच को main पर रीबेस करना, पुरानी रिमोट ब्रांचों को हटाना, और मर्ज कॉन्फ्लिक्ट सुलझाना। इनमें सही कमांड के साथ यह भी बताया जाता है कि वह आपके working tree पर ठीक-ठीक क्या असर डालेगा, जिससे Git के कम माफ़ करने वाले हिस्सों को लेकर होने वाली घबराहट काफ़ी कम हो जाती है।

खतरनाक कमांड्स के लिए बिल्ट-इन सुरक्षा

कुछ Git कमांड्स इतिहास को फिर से लिखते हैं या काम को हमेशा के लिए मिटा देते हैं, और यह जनरेटर कुछ भी रन करने से पहले ही उन्हें फ्लैग कर देता है। विनाशकारी विकल्प — git push --force, git reset --hard, git clean -f, -D से ब्रांच को फ़ोर्स-डिलीट करना, या checkout पर लोकल बदलाव छोड़ना — इन्हें खतरनाक माना जाता है और प्रीव्यू में चेतावनी दिखाई जाती है। कुछ ज़रूरी बातें ध्यान में रखें:

  • git reset --hard सभी अनकमिटेड बदलावों को बिना किसी ट्रैश बिन के हटा देता है; staged और unstaged दोनों तरह का काम चला जाता है।
  • git push --force रिमोट इतिहास को ओवरराइट कर देता है। इसकी बजाय --force-with-lease इस्तेमाल करना बेहतर है, जो यह टूल भी देता है, ताकि आप किसी साथी डेवलपर की कमिट्स को गलती से न मिटाएं।
  • git clean -f untracked फ़ाइलों को हमेशा के लिए डिलीट कर देता है; पहले -n चलाकर देखा जा सकता है कि क्या हटाया जाएगा, बिना कुछ छुए।

मक़सद यही है कि आप एक शक्तिशाली कमांड बनाएं और साथ ही उसी जगह यह भी समझें कि उसका असर कितना बड़ा होगा।

इसे इस्तेमाल कैसे करें और रिज़ल्ट कॉपी कैसे करें

कोई ऑपरेशन ढूंढने के लिए सर्च या फ़िल्टर करें, ज़रूरी वैल्यू भरें (रिपॉज़िटरी URL, ब्रांच नाम, कमिट मैसेज), और जो फ्लैग चाहिए उन्हें ऑन कर दें। कमांड रीयल-टाइम में अपडेट होता रहता है। जब यह सही लगे, तो एक क्लिक में इसे कॉपी करें — या इसे शेल एलियस के रूप में कॉपी करें, जिसे यह टूल अपने आप जनरेट कर देता है ताकि आप एक शॉर्टकट सीधे अपनी .zshrc या .bashrc में डाल सकें। चूंकि Git Command Generator सिर्फ़ टेक्स्ट बनाता है और कभी कुछ रन नहीं करता, इसलिए आप बेझिझक प्रयोग कर सकते हैं, रिज़ल्ट को अपने ही टर्मिनल में पेस्ट कर सकते हैं, और यह पूरा नियंत्रण आपके पास रहता है कि यह कब और कहां चलेगा।