← Back to Git Course | Chapter 10: Tools & Internals | Lesson 2 of 8

Git VS Code Integration

VS Code का Git panel आपके writing app में एक to-do sidebar जैसा है जो हर छुई हुई file list करता है और आपको एक click से save और share करने देता है।

Built-in Source Control

Source Control panel आपकी working directory की हर modified, added, और deleted file list करता है, और editor gutter बदली हुई lines को हरे (added) या नीले (modified) में सीधे आपके code के बगल में mark करता है — इसलिए आप file edit करते हुए ही देख सकते हैं कि क्या बदला।

उदाहरण: Built-in Source Control

bash
# Source Control panel lists modified/added/deleted files; gutter shows green (added) and blue (modified) markers

VS Code में Staging और Committing

किसी file के बगल में + click करना इसे Staged Changes group में move कर देता है, exactly git add जैसा; ऊपर box में एक message type करना और Commit दबाना (या Ctrl/Cmd+Enter) commit बनाता है — पूरा add-commit flow बिना कोई terminal खोले।

उदाहरण: Staging and Committing in VS Code

bash
# Click + next to a file to stage it, type a message, press Ctrl+Enter to commit

Branch Management

Current branch name हमेशा status bar में रहता है — इस पर click करना हर local और remote branch की एक searchable list खोलता है, आपको एक भी git checkout command type किए बिना उसी menu से एक checkout करने या एक नई बनाने देते हुए।

उदाहरण: Branch Management

bash
# Click the branch name in the status bar to open a searchable list of local and remote branches

Remotes के साथ Syncing

Sync Changes button एक pull और एक push को एक click में combine कर देता है, जो common case के लिए convenient है लेकिन जानना उचित है: अगर pull एक conflict बनाए, VS Code रुक जाता है और push half आगे बढ़ने से पहले आपको इसे resolve करने के लिए कहता है।

उदाहरण: Syncing with Remotes

bash
# Click 'Sync Changes' to pull then push in one click

GitLens Annotations

GitLens extension install करना सीधे आपके editor window के अंदर line-by-line author annotations add कर देता है। किसी line पर hover करना दिखाता है कि code किसने लिखा और यह किस commit से belong करती है।

उदाहरण: GitLens Annotations

bash
# Install the GitLens extension, hover a line to see its author and commit
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. एक file stage करने के लिए + click करना और यह मान लेना कि यह commit हो गई, जबकि आपको अभी भी एक message enter करके commit करना ज़रूरी है।
  2. commit करने से पहले status bar में current branch notice न करना, ताकि commit गलत branch पर पहुँच जाए।
  3. repository folder के बजाय VS Code में एक parent folder खोलना, ताकि Source Control panel कोई repository न दिखाए।

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.