Version Control in VSCode Flashcards
Q: How do you open the Source Control view in VSCode?
A: Click the Source Control icon in the sidebar or press Cmd+Shift+G.
Q: How do you initialise a Git repository in VSCode?
A: Open the Source Control view and click Initialize Repository.
Q: How do you stage changes in VSCode?
A: Click the + icon next to the file in the Source Control view.
Q: How do you unstage changes in VSCode?
A: Click the - icon next to the file in the Source Control view.
Q: How do you view file changes in VSCode?
A: Click on the file in the Source Control view to open a diff view.
Q: How do you commit changes in VSCode?
A: Enter a commit message in the text box at the top of the Source Control view and click the checkmark.
Q: How do you pull changes from a remote repository in VSCode?
A: Open the Command Palette (Cmd+Shift+P), type Git Pull, and select it.
Q: How do you push changes to a remote repository in VSCode?
A: Click the Sync Changes button in the status bar or use the Command Palette to run Git Push.
Q: How do you create a new branch in VSCode?
A: Open the Command Palette, type Git: Create Branch, and follow the prompts.
Q: How do you switch branches in VSCode?
A: Click the branch name in the status bar and select a branch from the dropdown.
Q: How do you merge branches in VSCode?
A: Open the Command Palette, type Git: Merge Branch, and select the branch to merge into the current branch.
Q: How do you view the commit history in VSCode?
A: Open the Source Control view and click the … menu, then select View Commit History (requires GitLens or similar extensions).
Q: How do you revert changes to a file in VSCode?
A: Right-click the file in the Source Control view and select Discard Changes.
Q: How do you resolve merge conflicts in VSCode?
A: Open the conflicting file, and VSCode will display conflict markers with options to accept changes.
Q: How do you view Git logs in VSCode?
A: Install the GitLens extension and use its interface to view Git logs.