Git Question and Answers
Git Question and Answers
1. **`git init`**:
- Initializes a new Git repository in the current directory.
```bash
git init
```
3. **`git status`**:
- Shows the current state of the working directory and staging area (which files
are staged, modified, or untracked).
```bash
git status
```
6. **`git push`**:
- Pushes local commits to the remote repository.
```bash
git push origin main
```
7. **`git pull`**:
- Fetches and merges changes from the remote repository into the local branch.
```bash
git pull origin main
```
8. **`git branch`**:
- Lists all local branches or creates a new branch.
```bash
git branch # List branches
git branch <new_branch> # Create a new branch
```
These Git commands are fundamental for version control, collaboration, and managing
project code efficiently.