Git VS Code Integration
In this page:
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
# 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
# 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
# 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
# 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
# Install the GitLens extension, hover a line to see its author and commit
- एक file stage करने के लिए
+click करना और यह मान लेना कि यह commit हो गई, जबकि आपको अभी भी एक message enter करके commit करना ज़रूरी है। - commit करने से पहले status bar में current branch notice न करना, ताकि commit गलत branch पर पहुँच जाए।
- repository folder के बजाय VS Code में एक parent folder खोलना, ताकि Source Control panel कोई repository न दिखाए।
Chapter Quiz — Complete all 8 topics to unlock
0/8 topics done
Complete these topics first: