### 1. `git init`
- **What it does**: Initializes a new Git repository in your project folder.
- **When to use**: Use it when you start a new project to begin tracking changes.
### 2. `git clone`
- **What it does**: Copies an existing Git repository from a remote server to your local machine.
- **When to use**: Use it to get a copy of a project from a remote server like GitHub.
### 3. `git add`
- **What it does**: Stages changes for commit. It tells Git which files to include in the next commit.
- **When to use**: Use it when you've made changes to your code and want to include those changes in your next commit.
### 4. `git commit`
- **What it does**: Saves your staged changes with a message describing what you did.
- **When to use**: Use it after adding changes with `git add` to create a checkpoint for your work.
### 5. `git status`
- **What it does**: Shows the current state of your repository, including untracked, modified, and staged files.
- **When to use**: Use it to see what's going on in your project before committing changes.
### 6. `git log`
- **What it does**: Displays a history of commits, including who made them and when.
- **When to use**: Use it to review the commit history of your project.
### 7. `git pull`
- **What it does**: Fetches changes from a remote repository (e.g., GitHub) and merges them into your current branch.
- **When to use**: Use it to update your local branch with changes from the remote repository.
### 8. `git push`
- **What it does**: Sends your committed changes to a remote repository (e.g., GitHub).
- **When to use**: Use it to share your work with others by uploading your changes to a remote server.
### 9. `git branch`
- **What it does**: Lists all branches in your repository and shows which branch you're currently on.
- **When to use**: Use it to see what branches exist and to switch between branches.
### 10. `git checkout`
- **What it does**: Switches to a different branch or commit.
- **When to use**: Use it to navigate between different branches or specific points in your project's history.
### 11. `git merge`
- **What it does**: Combines changes from one branch into another.
- **When to use**: Use it when you want to integrate changes from one branch into your current branch.
### 12. `git reset`
- **What it does**: Unstages changes or moves the current branch to a different commit.
- **When to use**: Use it when you need to undo commits or changes that haven't been committed yet.
### 13. `git remote`
- **What it does**: Shows a list of remote repositories (e.g., #GitHub) connected to your local repository.
- **When to use**: Use it to manage remote connections and repositories.
These are some fundamental Git commands that can help you get started with version control. Git can be a bit complex, but as you gain experience, you'll become more comfortable with its features and workflows.
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......