GitHub primarily involves using Git commands for version control and collaborating on projects. Here are some basic Git commands that you'll commonly use on GitHub:
1. Initializing a Repository:
git init: Initialize a new Git repository in the current directory.
2. Cloning a Repository:
git clone <repository_url>: Clone an existing remote repository to your local machine.
3. Adding and Committing Changes:
git add <file>: Stage changes in a file for the next commit.
git commit -m "Commit message": Commit staged changes with a descriptive message.
4. Checking Status and History:
git status: View the status of your working directory and staged changes.
git log: View the commit history, including commit messages and hashes.
5. Creating and Switching Branches:
git branch <branch_name>: Create a new branch.
git checkout <branch_name>: Switch to a different branch.
git checkout -b <branch_name>: Create and switch to a new branch in one step.
6. Merging Changes:
git merge <branch_name>: Merge changes from another branch into the current branch.
7. Pushing and Pulling Changes from Remote:
git push origin <branch_name>: Push local commits to a remote repository.
git pull origin <branch_name>: Pull remote changes to update your local repository.
8. Creating and Managing Pull Requests (GitHub-specific):
Fork a repository: Click the "Fork" button on a GitHub repository to create your own copy.
Create a Pull Request: After making changes in your fork, go to the original repository and open a Pull Request to propose your changes.
9. Handling Issues (GitHub-specific):
Create an Issue: On GitHub, you can create issues to report bugs, request features, or discuss tasks.
Reference Issues in Commits: You can link commits to issues by referencing the issue number in the commit message (e.g., "Fixes #123").