Getting Started with Git and Github

Getting Started with Git and Github

Uploading your Projects

  1. Version Control with Git

Git is a version control system that records changes to files over time.

It allows tracking modifications, reverting to previous versions, and collaborative work.

  1. Basic Git Commands

  • git init: Initializes a new Git repository.

  • git add : Adds files to the staging area.

  • git commit -m "Message": Saves the changes made to the repository.

  • git status: Shows the current status of the repository.

  • git log: Displays the commit history.

  1. Remote Repositories on GitHub

GitHub is a platform that hosts Git repositories remotely.

Create a new repository on GitHub and then link it to your local repository using git remote add origin .

  1. Uploading Projects to GitHub

Use git push origin to send your changes to GitHub.

The main branch is usually main or master.

  1. Collaborative Work

Allows other collaborators to clone your repository, make changes, and send pull requests.

  1. Branch Management

  • git branch <branch_name>: Creates a new branch.

  • git checkout <branch_name>: Switches to a specific branch.

  • git merge <branch_name>: Merges the changes from one branch into another.

Always remember to synchronize your local repository before starting new tasks with git pull origin .