Installation and Basic Commands for Windows and Linux

GitHub, Getting Started

GitHub is a web-based platform for version control and collaboration that allows developers to store, manage, and collaborate on their projects. GitHub uses Git, a distributed version control system created by Linus Torvalds, the creator of Linux.

What is GitHub?

GitHub is a Git repository hosting service that provides a simple, user-friendly interface for managing and collaborating on projects. It offers a wide range of features, including:

  1. Version control: Keep track of changes to your code and revert to earlier versions if necessary.
  2. Collaboration: Invite team members to contribute to your project and review changes before merging.
  3. Issue tracking: Track and manage bugs, enhancements, and other project-related issues.
  4. Project management: Use tools like boards and milestones to organize and prioritize your work.
  5. Integration: Connect with third-party tools and services like continuous integration and deployment systems.

Installing GitHub on Windows

  1. Download the Git for Windows installer from the official website: https://git-scm.com/download/win
  2. Run the installer and follow the setup wizard.
  3. Choose the components you want to install (default options are usually sufficient).
  4. Select the text editor you want to use with Git (e.g., Notepad++ or Vim).
  5. Configure the PATH environment variable to include Git (choose “Use Git from theWindows Command Prompt” or “Use Git and optional Unix tools from the Windows Command Prompt”).
  6. Choose the HTTPS transport backend (the default option is recommended).
  7. Configure line-ending conversions for your working directory (choose “Checkout Windows-style, commit Unix-style line endings” for cross-platform compatibility).
  8. Configure the terminal emulator to use with Git Bash (the default option is recommended).
  9. Click “Install” to complete the installation process.

Once installed, you can access Git by right-clicking on a folder in Windows Explorer and selecting “Git Bash Here” or by opening the Git Bash application from the Start menu.

Installing GitHub on Windows

    1. Download the Git for Windows installer from the official website: https://git-scm.com/download/win
    2. Run the installer and follow the setup wizard.
    3. Choose the components you want to install (default options are usually sufficient).
    4. Select the text editor you want to use with Git (e.g., Notepad++ or Vim).
    5. Configure the PATH environment variable to include Git (choose “Use Git from the Windows Command Prompt” or “Use Git and optional Unix tools from the Windows Command Prompt”).
    6. Choose the HTTPS transport backend (the default option is recommended).
    7. Configure line-ending conversions for your working directory (choose “Checkout Windows-style, commit Unix-style line endings” for cross-platform compatibility).
    8. Configure the terminal emulator to use with Git Bash (the default option is recommended).
    9. Click “Install” to complete the installation process.

    Once installed, you can access Git by right-clicking on a folder in Windows Explorer and selecting “Git Bash Here” or by opening the Git Bash application from the Start menu.

Installing GitHub on Linux

    1. Open the terminal (Ctrl+Alt+T).
    2. Update the package list using the following command:
    sudo apt-get update
    1. Install Git using the following command:
    sudo apt-get install git
    1. Verify the installation by checking the Git version:
    git --version
    1. Configure your Git user name and email using the following commands (replace “Your Name” and “you@example.com” with your actual information):
    git config --global user.name "Your Name"
    git config --global user.email "you@example.com"
     

Basic Commands to Know for Using GitHub

  1. git init: Initializes a new Git repository in the current directory.
  2. git clone <repository_url>: Creates a copy of a remote repository on your local machine.
  3. git add <file>: Adds a file to the staging area, preparing it for a commit.
  4. git commit -m "<message>": Commits the changes in the staging area with a descriptive message.
  5. git status: Shows the status of your working directory, including modified files, staged changes, and untracked files.
  6. git log: Displays the commit history in your repository.
  7. git diff: Shows the differences between the working directory and the last commit.
  8. git remote add origin <repository_url>: Connects your local repository to a remote GitHub repository.
  9. git push -u origin <branch_name>: Pushes your changes to the remote repository on the specified branch (usually ‘master’ or ‘main’).
  10. git pull: Fetches changes from the remote repository and merges them with your local branch.
  11. git fetch: Fetches changes from the remote repository but does not merge them.
  12. git merge <branch_name>: Merges changes from the specified branch into your current branch.
  13. git branch: Lists all branches in your repository and shows the current active branch.
  14. git checkout <branch_name>: Switches to the specified branch.
  15. git checkout -b <new_branch_name>: Creates a new branch and switches to it.
  16. git branch -d <branch_name>: Deletes the specified branch.
 

Conclusion

Now that you have been shown how to install GitHub on Windows and Linux and are familiar with some basic commands, you’re ready to start using GitHub to manage and collaborate on your projects. Remember, practice is key when it comes to mastering Git and GitHub.