Desishub Lessons
Html and Css Tutorial
Github and Git Desktop

GITHUB

Definition : GitHub is a cloud-based service that helps developers store their repositories(projects) online, collaborate with other programmers on code projects,share code publicly or privately and access a vast array of open-source projects and contribute to them.

Getting started with GitHub.

Go to GitHub and sign up for a free account if you haven't already.

Commonly used git commands to manage github repositories

1. Initializing a Repository

Terminal
git init

This command initializes a new Git repository in the current directory.

2. Cloning a Repository

git clone <repository_url>

This command clones(copy) an existing repository using its URL provided by github to your local machine.

3. Checking the Status

Terminal
git status

This command shows the status of the working directory. It lets you see which changes have been staged(made), which haven't, and which files aren't being tracked by Git.

4. Adding Files

git add .

This command adds all changes in the directory.

5. Committing Changes

Terminal
git commit -m "commit message"

This command commits the staged changes under a descriptive message.

6. Pushing Changes to a Remote Repository

git push origin <branch_name>

This command pushes the committed changes to the specified branch of the remote repository.

7. Pulling Changes from a Remote Repository

git pull origin <branch_name>

This command fetches and merges changes from the specified branch of the remote repository into your current branch.

8. Creating a New Branch

git branch <branch_name>

This command creates a new branch with the specified name.

git branch 

Lists all branches in your local repository.

9. Merging a Branch

git merge <branch_name>

This command merges the specified branch into the current branch.

10. Deleting a Branch

git branch -d <branch_name>

This command deletes the specified branch.

GITHUB DESKTOP

Definition : Is a graphical user interface (GUI) application that provides a convenient way to interact with GitHub repositories(projects). It simplifies the Git workflow, making it accessible to developers who prefer a visual approach over the command line.

IMPORTANCE

Cloning Repositories: simplifies cloning of repositories from GitHub to your local machine.

💡

Cloning: is making a copy of a repository stored on GitHub and putting it on your machine.

Committing Changes: Stage and commit changes with a user-friendly interface.

Branch Management: Create, switch, and merge branches visually.

Pull Requests: Review and create pull requests directly from the application.

Syncing Changes: Push and pull changes between local and remote repositories.

Getting Started with GitHub Desktop.

Download and Install GitHub Desktop

Go to GitHub Desktop website and download the application for your operating system. Install it following the on-screen instructions.

Sign in to GitHub Desktop

Launch GitHub Desktop and sign in using your GitHub account credentials.

Implementing GitHub Desktop Features.

1. Cloning

Click on the File menu at the top left corner of the GitHub Desktop window.

Select Clone repository... from the dropdown menu.

In the Clone a repository window that appears, select the tab GitHub.com if it's not already selected.

Browse or search for the repository you want to clone and click on the it to select it.

Choose where you want to clone the repository on your local machine by clicking Choose... next to Local Path. Select or create a folder/directory where you want the repository to be saved locally.

Finally click the clone button to start cloning.

2. Add a Local Repository

Launch GitHub Desktop on your computer. In the top menu, click on File and select Add Local Repository...

A dialog box will appear. Click the Choose... button to navigate to the directory where your local repository is stored. Select the folder and click Open.

After selecting the folder, confirm by clicking the "Add Repository" button.

If the repository is new and hasn't been published to GitHub yet, once you click the Publish repository button, a dialog box will appear asking for details about your repository, enter a name for your repository, optionally, you can add a description and Choose the visibility of your repository (Public or Private).

Finally click on the Publish Repository button to publish your local repository to GitHub.