Welcome to the world of GitHub! If you're new to version control, GitHub's command-line interface can seem a bit daunting. Fret not, for we've compiled a comprehensive guide on GitHub commands with practical examples to help you navigate like a pro. Let's dive in!

Before we begin, ensure you have Git installed on your system. If not, you can download and install it from the official website. Also, keep your Git version up-to-date for the best experience. Now, let's get started!

Setting Up Your GitHub Repo Locally
The first step is to initialize a local repository and connect it to your GitHub account.

First, navigate to the directory containing your project in your terminal. Then, initialize a new Git repository by typing:
```bash git init ```
This command initializes a new Git repository in the current directory. Now, let's connect this local repository to your GitHub account.

Connecting the Local Repository to GitHub
To connect your local repo to GitHub, first, log in to your GitHub account using the terminal:
```bash
git remote add origin Replace `

Basic GitHub Commands
Now that your local repository is connected to your GitHub account, let's explore some basic GitHub commands.
To check the status of your working directory and staging area, use:

```bash git status ```
Staging Files
Before you can commit your changes, you need to stage the files you want to commit. Use the following command to stage a file:




















```bash
git add To stage all changes in the current directory, use:
```bash git add . ```
Committing Changes
After staging your changes, it's time to commit them. Here's how you can do it:
```bash git commit -m "Your commit message here" ```
Replace "Your commit message here" with a brief, descriptive message summarizing the changes you've made.
Pushing and Pulling Changes
Now, let's see how to push and pull changes between your local repository and GitHub.
To push your committed changes to GitHub, use the following command:
```bash git push -u origin main ```
Note: Replace `main` with the name of your branch if you're not using `main`.
Pulling Changes from GitHub
To pull changes from GitHub to your local repository, use:
```bash git pull origin main ```
Branching and Merging
Branching and merging are essential GitHub concepts that allow multiple people to work on the same project without overwriting each other's changes.
To create a new branch, use:
```bash
git checkout -b Switching Between Branches
To switch to an existing branch, use:
```bash
git checkout To merge changes from one branch into another, first, switch to the branch where you want to merge the changes, then use:
```bash
git merge GitHub may occasionally throw a merge conflict error. In such cases, open the conflicting file, resolve the conflict, then stage and commit the file.
Viewing Commit History
To view the commit history of your GitHub repository, use the following command:
```bash git log ```
This command displays a timeline of all commits in the current branch. You can also use `git log --oneline --graph` to view a compact, graph-based representation of the commit history.
So, there you have it! With these GitHub commands in your toolbox, you're ready to tackle your next version control challenge. Happy coding!