Skip to content

Latest commit

 

History

History
126 lines (81 loc) · 3.84 KB

File metadata and controls

126 lines (81 loc) · 3.84 KB

How to Organize Your Code in Repository

A step-by-step guide to managing and organizing your code on GitHub using GitHub Desktop.


Table of Contents


Step 1: Download and Login to GitHub Desktop

Download GitHub Desktop for Windows from the official website and sign in with your GitHub account. For Linux users, you can follow this guide to install GitHub Desktop on Ubuntu.

Download GitHub Desktop


Step 2: Clone Your Repository

Cloning creates a local copy of your remote repository so you can edit files directly on your computer.

2.1. In GitHub Desktop, choose Clone a repository from the Internet.

Clone repository option

2.2. Select the repository you want to clone, choose a local path, then click Clone.

Clone confirmation dialog


Step 3: Organize Your Code

Fetch and Pull

Fetch — Check for new changes from the remote repository (GitHub) without modifying your local files.

Fetch from remote

Pull — Download the changes from the remote repository and merge them into your current branch.

Pull changes


Create and Move Files

3.1. Open the repository folder in File Explorer using the Show in Explorer option.

Show repository in Explorer

3.2. Create a new folder to organize your code by topic or category.

Create a new folder

3.3. Cut the code files you want to move.

Cut code files

3.4. Paste them into the new folder.

Paste files into new folder


Commit and Push

3.5. Back in GitHub Desktop, enter a Commit Message describing your changes, then click Commit to main.

Note: A commit message is required. For example: "update leetcode".

Enter commit message

3.6. Click Push origin to send your local commits to the remote repository on GitHub.

Push commits to GitHub


Verify on GitHub

3.7. Press F5 to refresh your GitHub page. The new folder should now appear in your repository.

New folder visible on GitHub

Final repository structure


Have fun coding!