
Version Control & Git
Git basics, branches, merge, rebase, pull requests, commit conventions, gitflow workflow
1What is Git?
What is Git?
回答
Git is a distributed version control system that tracks changes to source code over time. Each developer has a complete copy of the project history on their local machine, unlike centralized systems like SVN. This enables offline work and provides better resilience as there is no single point of failure.
2Which command initializes a new Git repository in a folder?
Which command initializes a new Git repository in a folder?
回答
The git init command creates a new local Git repository in the current directory by creating a hidden .git subfolder containing all repository metadata files. This command is the first step to start tracking changes with Git in an existing or new project.
3Which command adds files to the staging area (index) before committing them?
Which command adds files to the staging area (index) before committing them?
回答
The git add command adds file changes to the staging area (transit zone). This intermediate step between modification and commit allows you to precisely select which changes to include in the next commit. For example, git add . adds all modified files, while git add file.txt adds only that specific file.
Which command records changes from the staging area into Git history?
How to create a new Git branch and switch to it immediately?
+17 面接問題