Skip to main content

Using Git and GitHub for Basic Web Development

1. Create a Repository on GitHub:

  • Go to GitHub and log in.
  • Click on the "+" sign in the top right corner and select "New Repository."
  • Give your repository a name, add a description, and click "Create repository."

2. Forking a Repository:

  • Find a repository on GitHub that you'd like to contribute to.
  • Click on the "Fork" button in the top right corner of the repository's page.
  • This creates a copy of the repository in your GitHub account.

3. Clone the Repository:

  • Open your terminal or command prompt.
  • Use the git clone command to copy the repository to your local machine:
    git clone https://github.com/your-username/repository-name.git

4. Add, Commit, and Push Changes:

  • Navigate to your project folder using the cd command:
    cd repository-name
  • Make changes to the project using your IDE.
  • Use the following commands to save your changes to Git:
    git add .
    git commit -m "Your commit message"
    git push origin main

5. Pull Request:

  • If you forked a repository and made changes, you can open a pull request to suggest your changes to the original repository.
  • On the GitHub page of your forked repository, click on "New pull request."

By following these steps, you've created a repository, forked a project, cloned it to your local machine, made changes, and pushed those changes back to GitHub. This is the basic workflow for collaborating on projects using Git and GitHub. Happy coding!